I have a script to encode videos (using mencoder), but is there a way to add a simple "fade out/in to black" from the command line, preferably free (as in open source).
It could be either on Windows or Ubuntu Linux.
The only thing I could find – based on the command line – is
Specifically, it features the
Best would be if you edit this question and supply an example that worked for you!
A recent ffmpeg with the 'fade' video filter can do this. Unfortunately, the ffmpeg in the Ubuntu repos doesn't have filters enabled for some inane reason, so you'll have to get it from somewhere else (see here).
To fade in from black, starting at frame 0, over 50 frames (2 seconds @ 25fps):
To fade out starting at frame 21000 (14 minutes @ 25fps), over 50 frames:
You can combine the two into a filterchain:
As you can see from these examples, you have to transcode video when using a video filter. Since ffmpeg and mencoder share many libraries, it should be fairly easy to re-write your scripts to use ffmpeg instead of mencoder & avoid an unnecessary extra encode. I'm pretty sure that you can achieve the same thing in mencoder, but I don't know mencoder syntax.
I have this bash script to fade out the end of movies (audio + video) automatically :