I'm using avconv for trimming and converting videos. Let's say I want to drop the first 7 and last 2.5 seconds of the video stream and one audio stream of an one-hour mts file:

avconv -i input.mts -map 0:0 -map 0:3 -ss 0:0:07 -t 0:59:50.5 out.mov

This works so far, but now I want to add two seconds of fading in and out at the beginning and the end by adding:

-vf fade=type=in:start_frame=350:nb_frames=100 -vf fade=type=out:start_frame=178750:nb_frames=100

Those frames are calculated with the 50 fps that avconv reports for the video source. But there is neither fading in nor out.

1) What goes wrong with the video fading and how to do it right? 2) How to add audio fading. There seems to be an -afade option. but I don't find it documented.

Alternatively, you can propose a different tool for this goal (trim and fade video and audio), preferrably available as package for Debian 8.


2 Answers 2


I finally found the time to try the answer suggested by @Mario G., but it seemed extremely cumbersome. I need to do this many dozens of times. I read the documentation of ffmpeg and found it much more powerful than avconv, including fading for audio and video, so the solution is

ffmpeg -i input.mts -map 0:0 -map 0:3 -ss 0:0:07 -to 0:59:57.5 -vf 'fade=t=in:st=7:d=2,fade=t=out:st=3595.5:d=2,crop=out_h=692' -af 'afade=t=in:st=7:d=2,afade=t=out:st=3595.5:d=2' out.mov

So the st= and d= parameters for the fade take times in seconds, no need for converting to frames.

I also discovered the -to option to take the end time directly instead of calculating the length.

This command does all steps

  • channel selection with -map,
  • trimming with -ss and -to,
  • video fading with -vf option fade=t=in and fade=t=out,
  • audio fading with -af option afade=t=in and afade=t=out and
  • cropping with -vf option crop=

in a single step.

  • Seems convenient. Could you explain the individual parameters, please? Mar 29, 2021 at 15:05
  • I added which parameter does what. For more detail, the ffmpeg documentation is the best source.
    – Philippos
    Apr 1, 2021 at 7:41
  • Thank you. I think this is the a great solution as no multiple commands and no generation of auxiliary data is required. Apr 6, 2021 at 3:18


ffmpeg -i input.mts -ss 00:00:20.0 -c copy -t 00:00:30.0 output.mkv

Seek 20 seconds -(i)n input.mkv (and discard, by default) let it play for 30 seconds and discard everything else from there. So you've got a 30 seconds video.


First you need to create an image for your fades. Probably a single *.png image, full white or full black depending on your taste. In the same resolution your video was recorded, preferably.

ffmpeg -r 1/2 -i black.png -c:v libx264 -r 50 -y -pix_fmt yuv420p fade2s.mkv

This means, fade 2 seconds (-r input:1 / 2 x 50 frames per second = 100 fps). For the image info you can check The Gimp or ImageMagick. Now you've got your fade effect.

Fade In:

ffmpeg -i fade2s.mkv -y -vf fade=in:0:50 fade_in.mkv

Fade in from 0 to 50 frames (1 second - 50fps)

Fade In + Out: Take the last input as your fade in and add some fade out

ffmpeg -i fade_in.mkv -y -vf fade=out:120:50 fade_in_out.mkv


  • Three of our children were in the hospital the last days, so I wasn't able to check your solution. But I trust you and reward the bounty. I'll come back after I find the time. Thank you.
    – Philippos
    Jun 26, 2017 at 5:40
  • Thank you again, mainly for leading me to use ffmpeg instead of avconv. I found an ffmpeg-solution now.
    – Philippos
    Aug 14, 2017 at 5:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .