[FFmpeg-user] concat filter

Nicolas George nicolas.george at normalesup.org
Sun Oct 28 10:38:05 CET 2012


Le quartidi 4 brumaire, an CCXXI, Michael Henson a écrit :
> However if I want to have the logo appear first, then the video, it
> does not work. The command line is:
> 
>  ffmpeg -r 30 -loop 1 -i logo.jpg -i a.mov -t 14.48 -filter_complex
> '[0:0]setsar=0:1,scale=480:360,fade=in:0:30,fade=out:60:30[top];[1:1]fade=in:0:30[mid];[top][mid]concat'
> out.mpeg
> 
> Note that all that has changed is the order that the input pad's are
> named for the concat filter. The result is that I get the fade to
> logo, fade from logo, but then nothing but black (although I do get
> audio).

The problem is that your logo as an infinite duration, due to the -loop
option. The second fade makes it fade to black after 3 seconds, but after
the fade to black, the [top] stream still receives black frames
indefinitely. Therefore, the concat filter continues to read on that one and
never tries to read on [mid].

There is currently no elegant or simple way of solving this problem. I can
suggest one solution:

First, duplicate the logo, so that there are two frames, one to mark the
end: "cp logo.jpg logo0.jpg; cp logo.jpg logo1.jpg" (or ln -s).

Then use these logos as input, at 1/3 FPS, but re-setting the 30 FPS in the
filters: -r 1/3 -i logo%d.jpg ... '[0:0]fps=fps=30' ...

Note that this is rather fragile, as it relies on the fact that the fps
filter does not duplicate the last frame to accommodate its duration (it
should), and it produces an extra frame (0-90 instead of 0-89).

A more robust solution would be to just produce your logo file in a lossless
format. Since it is only 3 seconds, the overhead is not severe.

In some distant future there may be several other solutions (-t as an input
option, EOF after the end of the fade, scripted stream selection), but not
yet.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20121028/0e47b66c/attachment.asc>


More information about the ffmpeg-user mailing list