[FFmpeg-user] Please release me from despair: multiple overlay images with fade in + out

Dog Film dogfilm at gmail.com
Wed Jan 21 23:04:49 CET 2015


Dear Master Sabatini,

thank you so much, it finally works now. In fact I had a very similar
solution yesterday and was so sure, that this must be right, I was
reading the overlay and fade manual entries over and over again, but I
missed the fact that -t  is needed here and it did not work.

Without the -t $DURATION parameter what happens is, that ffmpeg
renders to the last frame, then the fps goes down to something between
1.7 - 3.4 or similar and the drop value is constantly rising - and the
encoding never stops. Looks like this:

> frame=  751 fps=3.3 q=28.0 size=    1526kB time=00:00:27.72 bitrate= 451.0kbits/s dup=0 drop=13218

The video is generated and the result is ok, but the process never
stops (at least it does not stop in an expected timeframe)

Why does this happen? Why does this need the -t value, when I feed a
video with fixed length?

Is it possible to avoid having to use -t ? (Saving me one roundtrip of
getting the length of the input video.)

This is what I have now working, with a 'real' video file (not a
generated-on-the one) as first input:

SLIDES='test-05'
VID_A=${DIR_IN}'colors-1920x1080-30sec.mov'
png_0="/home/xxx/Dev/Video/assets/slides/${SLIDES}/slide_000.png"
png_1="/home/xxx/Dev/Video/assets/slides/${SLIDES}/slide_001.png"
png_2="/home/xxx/Dev/Video/assets/slides/${SLIDES}/slide_002.png"
FILENAME=${DIR_OUT}Lecture-16-Overlay-Fade-Trans-09.mov
${FFMPEG} -i ${VID_A} -loop 1 -i ${png_1} -loop 1 -i ${png_2} -filter_complex "
[1:0] format=rgba,fade=in:st=5:d=2:alpha=1,fade=out:st=8:d=2:alpha=1 [t0];
[2:0] format=rgba,fade=in:st=10:d=2:alpha=1,fade=out:st=13:d=2:alpha=1 [t1];
[0:0][t0] overlay [t2];
[t2][t1] overlay=x=100:y=100" -t 30 -y ${FILENAME}

I did not try, however, with really long videos and lots of files, I
will have to change my script for this a little bit, but will report
then back!

The colors-1920x1080-30sec.mov is a 30 second test video that was
generated like this:
ffmpeg -y -f lavfi -i testsrc=duration=30:size=1920x1080:rate=25
-filter_complex "fade=out:700:50" -vcodec png
colors-1920x1080-30sec.mov

the slides are just pdf files converted with imagemagick to png.
(just for reference, if the input format of the video plays any role
for the use of the -t parameter in the above filter graph, what I do
not believe, but hey, I still do not understand all that ffmpeg
magic...)


Thanks again for your attention,
I was released and feel lucky now :),
have a nice day,
John


More information about the ffmpeg-user mailing list