Multiple fadeIn/fadeOut effects in one audio file

2019-03-16 05:28发布

I have some problem to add several fade effects to one audio file. When I try to use a command like this:

ffmpeg -y -i /home/user/video/test/sound.mp3 -af "afade=t=in:ss=0:d=3,afade=t=out:st=7:d=3,afade=t=in:st=10:d=3,afade=t=out:st=17:d=3,afade=t=in:st=20:d=3,afade=t=out:st=27:d=3" /tmp/test.mp3

then my output audio file has a fadein and fadeout applied only once. All the next effects don't get applied. Is there any possible way to apply several fade effects to the same audio file? Also, what is the difference between ss and st parameter in this command?

标签: audio ffmpeg
3条回答
家丑人穷心不美
2楼-- · 2019-03-16 05:46

take a look here: ffmpeg volume filters

volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame

complete command:

ffmpeg -i movie.wav -filter volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame modified-movie.wav
查看更多
疯言疯语
3楼-- · 2019-03-16 05:50

The problem is that after fading out the audio you are trying to fade in the silence.

The solution is to disable the fade out filter when you want to start fading in.

You can achieve that with Timeline Editing to enable the filters for a particular amount of time.

The following example works just fine:

ffmpeg -i input.mp3 -af "afade=enable='between(t,0,3)':t=in:ss=0:d=3,afade=enable='between(t,7,10)':t=out:st=7:d=3,afade=enable='between(t,10,13)':t=in:st=10:d=3,afade=enable='between(t,13,16)':t=out:st=13:d=3" -t 16 output.mp3
查看更多
Evening l夕情丶
4楼-- · 2019-03-16 05:57

Works for me with ffmpeg 2.5.2.

I'm using fade in and fade out audio filter, both for the duration of 3 seconds.

ffmpeg -i audio.mp3 -af 'afade=t=in:ss=0:d=3,afade=t=out:st=27:d=3' out.mp3

I'd recommend to upgrade your ffmpeg, as this might be a bug. More information in the docs.

查看更多
登录 后发表回答