While you might think ffmpeg is well documented on Linux given its relative maturity, I found the docs provided very confusing and even misleading as some filters (like “afade”) referenced in many examples weren’t even availble on Ubuntu 12.04 LTS. (check your own version using the “-filters” ffmpeg argument: After much searching and googling, I arrived at the solution below and I’m documenting it here for my own use and posterity 😉
Get the latest static ffmpeg build to make sure you have the “afade” filter available for Linux:
Extract ffmpeg to somewhere in your path (I use $HOME/bin).
Extract 70 seconds of audio, starting at 60 seconds into the file:
ffmpeg -i test.mp3 -ss 60 -t 70 test01.mp3
Add the fade-in effect (4 seconds):
ffmpeg -i test01.mp3 -af "afade=t=in:ss=0:d=4" test02.mp3
Add the fade-out effect (5 seconds, starting at 65 seconds) to the new file:
ffmpeg -i test02.mp3 -af "afade=t=out:st=65:d=5" test03.mp3
I guess this could be done in a better way, combining the snipping and the filtering in one go, but I couldn’t figure out the correct filter / snipping syntax. If you do, please comment.