Concatenate multiple (<10) movies with xfade filter

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Concatenate multiple (<10) movies with xfade filter

Kentaro Fukuchi
Hi,

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 developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration:
  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
    Metadata:
      handler_name    : VideoHandler
Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_xfade_0

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.

Kentaro

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate multiple (<10) movies with xfade filter

Paul B Mahol
On 6/10/20, Kentaro Fukuchi <[hidden email]> wrote:

> Hi,
>
> 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
> developers
>   built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
>   configuration:
>   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
>     Metadata:
>       handler_name    : VideoHandler
> Cannot find a matching stream for unlabeled input pad 1 on filter
> Parsed_xfade_0
>
> 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.

>
> Kentaro
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate multiple (<10) movies with xfade filter

Nicolas George
Paul B Mahol (12020-06-10):
> xfade filter can not work with concat demuxer output.

That would be a bug. Please report it properly.

Regards,

--
  Nicolas George

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate multiple (<10) movies with xfade filter

Paul B Mahol
On 6/10/20, Nicolas George <[hidden email]> wrote:
> Paul B Mahol (12020-06-10):
>> xfade filter can not work with concat demuxer output.
>
> That would be a bug. Please report it properly.
>

How so it is a bug? xfade needs 2 inputs.
concat demuxer gives single output.

> Regards,
>
> --
>   Nicolas George
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate multiple (<10) movies with xfade filter

Nicolas George
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.

Regards,

--
  Nicolas George

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate multiple (<10) movies with xfade filter

Paul B Mahol
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.

>
> Regards,
>
> --
>   Nicolas George
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate multiple (<10) movies with xfade filter

Nicolas George
Paul B Mahol (12020-06-10):
> It can work with its output just fine, just not in way user imagined.

So your statement:

| xfade filter can not work with concat demuxer output.

was actually wrong?

--
  Nicolas George

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Concatenate multiple (<10) movies with xfade filter

Carl Zwanzig
In reply to this post by Paul B Mahol
On 6/10/2020 7:24 AM, Paul B Mahol wrote:

> 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.

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-
111111111----
        xx
-------222222222----
               xx
--------------3333333
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.


z!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".