Decode MP3, then increase the audio volume, and then encode the new audio

眉间皱痕 提交于 2019-12-04 11:11:48

问题


I want to first decode a MP3 audio file, and then increase the volume of the audio, and then encode it again into a new MP3 file. I want to use libavformat or libavcodec for this. Can you help me how I can do this? Any example?


回答1:


You can use the "-filter" parameter with the "volume" option to set a multiplier for the audio. More info: http://ffmpeg.org/ffmpeg-filters.html#volume

Since you are dealing only with MP3 files (that have only one audio track), you can use the "-af" parameter, which is an alias for "-filter:a".

For instance,

ffmpeg -i input.mp3 -af 'volume=1.5' output.mp3

would increase the volume in 50% and create the output file with the same codec as input (MP3).



来源:https://stackoverflow.com/questions/21496031/decode-mp3-then-increase-the-audio-volume-and-then-encode-the-new-audio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!