[FFmpeg-user] Audio transcoding, trim and fade-in/fade-out one-liner

Joost Schuttelaar joost at greenskin.net
Sat May 31 22:17:02 CEST 2014


Hi everyone,

I'm creating a small gizmo using the Raspberry-Pi to record live jamsessions and share small segments of them on SoundCloud. Basically, it perpetually records to a big FLAC file and I want to take out some segments which have a short fade-in/fade-out.

I can do it using two runs of FFMPEG, but for some reason I haven't been able to do it in a nice one line incantation.

This works fine (take 30 secs from 50 seconds in):

ffmpeg -i recording.flac -ss 00:00:50 -t 30 tmp.wav ;
ffmpeg -i tmp.wav -af afade=t=in:st=0:d=2,afade=t=out:st=20:d=10 segment.wav ;
rm tmp.wav

I would've thought either of these two would be the equivalent, but they're not. I just get silence:

ffmpeg -i recording.flac -ss 00:00:50 -t 30 -af afade=t=in:ss=0:d=2,afade=t=out:ss=20:d=10 segment.wav
ffmpeg -i recording.flac -ss 00:00:50 -t 30 -af afade=t=in:ss=50:d=2,afade=t=out:ss=70:d=10 segment.wav

Using a temporary file is not a huge problem, but I always like the most elegant solution :) plus I'm pushing the r-pi already to the max...

Does anyone know? Thanks! :)

-- 

Joost Schuttelaar
The Hague, NL



More information about the ffmpeg-user mailing list