python – I install ffmpeg in the AWS EC2 environment and convert the audio .wav file to .m4a, but I’m having trouble with loud noise
I install ffmpeg in the aws EC2 environment and convert the audio wav file to m4a, but I’m having trouble with loud noise I don’t know how to set parameters without noise.
The ffmpeg version is ffmpeg-5.1.1-amd64-static.
In this same environment, ffmpeg can convert video .mov
files to .mp4
.
Source code:
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 + "https://superuser.com/" + str(m_result.push_voice1)
dir_out = settings.MEDIA_ROOT + "https://superuser.com/" + 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 + "https://superuser.com/" + 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
Read more here: Source link