我在aws EC2环境中安装了ffmpeg,并将音频wav文件转换为m4a,但是我遇到了很大的噪音问题,我不知道如何设置没有噪音的参数。
ffmpeg版本是ffmpeg-5.1.1-amd64-static。
在同样的环境下,ffmpeg 可以将视频.mov
文件转换为.mp4
.
将 .wav 转换为 .m4a
源代码:
if '.m4a' not in m_result.push_voice1.name:
v_f_m4a = m_result.push_voice1.name.split('.')[0] + '.m4a' # info_audio/hoge.m4a
dir_in = settings.MEDIA_ROOT + '/' + str(m_result.push_voice1)
dir_out = settings.MEDIA_ROOT + '/' + v_f_m4a # lp_photo1
stream = ffmpeg.input(dir_in) # .wav file input
# output
stream = ffmpeg.output(stream, dir_out) # .m4a file output
# execution
ffmpeg.run(stream, overwrite_output=True, capture_stdout=True, capture_stderr=True) # generate m4a
dir_in = settings.MEDIA_ROOT + '/' + str(m_result.push_voice1)
os.remove(dir_in) #media/info_audio/hoge.wav
m_result.push_voice1 = v_f_m4a # Rewrite to new file name info_audio/hoge.m4a
m_result.save() # update