我有一个文本文件,其中包含Numpy数组的输出,并希望使用FFMPEG将其转换为mp3文件。
我一直关注this tutorial,并且从视角来看,我基本上已经创建了一个文本文件audio_array
,我想稍后在我的文章中阅读编程到FFMPEG并转换回mp3文件。
我尝试按如下方式修改下面的部分,但它似乎没有给我一个输出:
pipe = sp.Popen([ FFMPEG_BIN,
'-y', # (optional) means overwrite the output file if it already exists.
"-f", 's16le', # means 16bit input
"-acodec", "pcm_s16le", # means raw 16bit input
'-r', "44100", # the input will have 44100 Hz
'-ac','2', # the input will have 2 channels (stereo)
'-i', '[path/to/my/text_file.txt]',
'-vn', # means "don't expect any video input"
'-acodec', "libfdk_aac" # output audio codec
'-b', "3000k", # output bitrate (=quality). Here, 3000kb/second
'my_awesome_output_audio_file.mp3'],
stdin=sp.PIPE,stdout=sp.PIPE, stderr=sp.PIPE)