> Here I have more than 10 movies and want to concatenate into a single movie
> with cross-fade effect. I tried to use 'xfade' filter with many thanks to
> the authors of it, but I had no luck.
> What I did:
> ffmpeg -f concat -i movies.txt -filter_complex
> "xfade=transition=fade:duration=1" output.mp4
> What I received:
> ffmpeg version N-98092-g7ab375f574 Copyright (c) 2000-2020 the FFmpeg
> built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
> libavutil 56. 52.100 / 56. 52.100
> libavcodec 58. 92.100 / 58. 92.100
> libavformat 58. 46.101 / 58. 46.101
> libavdevice 58. 11.100 / 58. 11.100
> libavfilter 7. 86.100 / 7. 86.100
> libswscale 5. 8.100 / 5. 8.100
> libswresample 3. 8.100 / 3. 8.100
> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x55aa7f382000] Auto-inserting h264_mp4toannexb
> bitstream filter
> Input #0, concat, from 'movies.txt':
> Duration: N/A, start: 0.000000, bitrate: 5521 kb/s
> Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
> 1280x720, 5521 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
> handler_name : VideoHandler
> Cannot find a matching stream for unlabeled input pad 1 on filter
> Additional note:
> The following worked as expected:
> ffmpeg -i movie1.mp4 -i movie2.mp4 -filter_complex
> xfade=transition=fade:duration=1 output.mp4
> Seems that the combination of filter_complex and concat format does not work
> as expected.
> How can I use filter_complex and xfade filter with concat format? Any
> suggestions are welcome.
xfade filter can not work with concat demuxer output.
Re: Concatenate multiple (<10) movies with xfade filter
On 6/10/20, Nicolas George <[hidden email]> wrote:
> Paul B Mahol (12020-06-10):
>> How so it is a bug? xfade needs 2 inputs.
>> concat demuxer gives single output.
> A filter that "can not work with" the output of another filter, your
> words, is a bug. Filters should all work together seamlessly.
It can work with its output just fine, just not in way user imagined.
>> Paul B Mahol (12020-06-10):
>>> How so it is a bug? xfade needs 2 inputs.
>>> concat demuxer gives single output.
>> A filter that "can not work with" the output of another filter, your
>> words, is a bug. Filters should all work together seamlessly.
> It can work with its output just fine, just not in way user imagined.
Which seems entirely correct, even if the phrasing may be poor.
Back to the user's problem.
If you concat the files, the xfade filter has nothing to work with since
it's getting a single stream. To do what you're asking, you need to tell
ffmpeg when to "start" the incoming stream (before the outgoing one ends)
and start the xfade -then-.
in ascii art-
the streams must overlap.
IMHO, this is not a simple one-line single command. You need to know the
length of each segment, then backtime from the end of each when to start the
next one and when to xfade.
If this is recurring task, write a script to do the calculations. If it's a
one-time deal, use some video editor software.