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.
Best Answer
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 thanavconv
, including fading for audio and video, so the solution isSo the
st=
andd=
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
-map
,-ss
and-to
,-vf
optionfade=t=in
andfade=t=out
,-af
optionafade=t=in
andafade=t=out
and-vf
optioncrop=
in a single step.