[FFmpeg-user] filter_complex out-of-sync videos

amindfv at mailbox.org amindfv at mailbox.org
Sat Jan 8 07:20:12 EET 2022


On Fri, Jan 07, 2022 at 12:54:06AM -0800, amindfv--- via ffmpeg-user wrote:
> OS: Debian 11.2, latest ffmpeg git master.
> 
> I've got a fairly simple filtergraph that's been giving me quite a hard time in terms of starting or staying in sync. I've boiled it down to a test case with three input videos, two identical (i.e. the same file), which clearly shows at least a frame of difference: the alpha channel appears to change at least a frame before the video channel whose input is the same. This leaves very weird ghosting anytime there's significant motion in the source video.
> 
> What's going on here? Do I need to force synchronization myself? Is something else happening?

Should I provide sample video files to demonstrate the issue?

> Thanks,
> Tom
> 
> Full uncut console output:
> 
> $ ./ffmpeg -i <vid1.mp4> -i <vid2.mp4> -i <vid2.mp4> -filter_complex '[1:v]extractplanes=y[A], [0:v][A]alphamerge[B], [2:v][B]overlay' -q 1 -t 300 alphatest.mp4
> ffmpeg version N-105195-g242ed971cb Copyright (c) 2000-2022 the FFmpeg developers
>   built with gcc 10 (Debian 10.2.1-6)
>   configuration:
>   libavutil      57. 18.100 / 57. 18.100
>   libavcodec     59. 20.100 / 59. 20.100
>   libavformat    59. 17.100 / 59. 17.100
>   libavdevice    59.  5.100 / 59.  5.100
>   libavfilter     8. 25.100 /  8. 25.100
>   libswscale      6.  5.100 /  6.  5.100
>   libswresample   4.  4.100 /  4.  4.100
> Input #0, matroska,webm, from '<vid1.mp4>':
>   Metadata:
>     encoder         : libebml v1.3.0 + libmatroska v1.4.1
>     creation_time   : 2013-12-12T19:56:29.000000Z
>   Duration: 01:50:01.18, start: 0.000000, bitrate: 2206 kb/s
>   Stream #0:0: Video: h264 (High), yuv420p(tv, bt709/bt709/unknown, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
>     Metadata:
>       title           : <title>
>   Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 96 kb/s (default)
>     Metadata:
>       title           : English Audio - <title>
> Input #1, matroska,webm, from <vid2.mp4>:
>   Metadata:
>     encoder         : libebml v1.2.0 + libmatroska v1.1.0
>     creation_time   : 2011-04-25T23:32:27.000000Z
>   Duration: 01:40:40.11, start: 0.000000, bitrate: 7289 kb/s
>   Chapters:
>     Chapter #1:0: start 0.000000, end 76.033611
>       Metadata:
>         title           : Chapter 1
>     Chapter #1:1: start 76.033611, end 326.575567
>       Metadata:
>         title           : Chapter 2
>     Chapter #1:2: start 326.575567, end 975.640656
>       Metadata:
>         title           : Chapter 3
>     Chapter #1:3: start 975.640656, end 1506.128944
>       Metadata:
>         title           : Chapter 4
>     Chapter #1:4: start 1506.128944, end 1871.368822
>       Metadata:
>         title           : Chapter 5
>     Chapter #1:5: start 1871.368822, end 2241.613689
>       Metadata:
>         title           : Chapter 6
>     Chapter #1:6: start 2241.613689, end 2731.352944
>       Metadata:
>         title           : Chapter 7
>     Chapter #1:7: start 2731.352944, end 3046.250856
>       Metadata:
>         title           : Chapter 8
>     Chapter #1:8: start 3046.250856, end 3321.609278
>       Metadata:
>         title           : Chapter 9
>     Chapter #1:9: start 3321.609278, end 3487.399900
>       Metadata:
>         title           : Chapter 10
>     Chapter #1:10: start 3487.399900, end 3803.841022
>       Metadata:
>         title           : Chapter 11
>     Chapter #1:11: start 3803.841022, end 3982.060733
>       Metadata:
>         title           : Chapter 12
>     Chapter #1:12: start 3982.060733, end 4591.919989
>       Metadata:
>         title           : Chapter 13
>     Chapter #1:13: start 4591.919989, end 4818.646489
>       Metadata:
>         title           : Chapter 14
>     Chapter #1:14: start 4818.646489, end 5397.474733
>       Metadata:
>         title           : Chapter 15
>     Chapter #1:15: start 5397.474733, end 5918.161567
>       Metadata:
>         title           : Chapter 16
>     Chapter #1:16: start 5918.161567, end 6039.491111
>       Metadata:
>         title           : Chapter 17
>     Chapter #1:17: start 6039.491111, end 6040.106000
>       Metadata:
>         title           : Chapter 18
>   Stream #1:0(eng): Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
>   Stream #1:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
>   Stream #1:2(eng): Audio: aac (LC), 48000 Hz, mono, fltp
>   Stream #1:3(eng): Subtitle: subrip (default)
> Input #2, matroska,webm, from <vid2.mp4>:
>   Metadata:
>     encoder         : libebml v1.2.0 + libmatroska v1.1.0
>     creation_time   : 2011-04-25T23:32:27.000000Z
>   Duration: 01:40:40.11, start: 0.000000, bitrate: 7289 kb/s
>   Chapters:
>     Chapter #2:0: start 0.000000, end 76.033611
>       Metadata:
>         title           : Chapter 1
>     Chapter #2:1: start 76.033611, end 326.575567
>       Metadata:
>         title           : Chapter 2
>     Chapter #2:2: start 326.575567, end 975.640656
>       Metadata:
>         title           : Chapter 3
>     Chapter #2:3: start 975.640656, end 1506.128944
>       Metadata:
>         title           : Chapter 4
>     Chapter #2:4: start 1506.128944, end 1871.368822
>       Metadata:
>         title           : Chapter 5
>     Chapter #2:5: start 1871.368822, end 2241.613689
>       Metadata:
>         title           : Chapter 6
>     Chapter #2:6: start 2241.613689, end 2731.352944
>       Metadata:
>         title           : Chapter 7
>     Chapter #2:7: start 2731.352944, end 3046.250856
>       Metadata:
>         title           : Chapter 8
>     Chapter #2:8: start 3046.250856, end 3321.609278
>       Metadata:
>         title           : Chapter 9
>     Chapter #2:9: start 3321.609278, end 3487.399900
>       Metadata:
>         title           : Chapter 10
>     Chapter #2:10: start 3487.399900, end 3803.841022
>       Metadata:
>         title           : Chapter 11
>     Chapter #2:11: start 3803.841022, end 3982.060733
>       Metadata:
>         title           : Chapter 12
>     Chapter #2:12: start 3982.060733, end 4591.919989
>       Metadata:
>         title           : Chapter 13
>     Chapter #2:13: start 4591.919989, end 4818.646489
>       Metadata:
>         title           : Chapter 14
>     Chapter #2:14: start 4818.646489, end 5397.474733
>       Metadata:
>         title           : Chapter 15
>     Chapter #2:15: start 5397.474733, end 5918.161567
>       Metadata:
>         title           : Chapter 16
>     Chapter #2:16: start 5918.161567, end 6039.491111
>       Metadata:
>         title           : Chapter 17
>     Chapter #2:17: start 6039.491111, end 6040.106000
>       Metadata:
>         title           : Chapter 18
>   Stream #2:0(eng): Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
>   Stream #2:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
>   Stream #2:2(eng): Audio: aac (LC), 48000 Hz, mono, fltp
>   Stream #2:3(eng): Subtitle: subrip (default)
> Stream mapping:
>   Stream #0:0 (h264) -> alphamerge (graph 0)
>   Stream #1:0 (h264) -> extractplanes:default (graph 0)
>   Stream #2:0 (h264) -> overlay (graph 0)
>   overlay:default (graph 0) -> Stream #0:0 (mpeg4)
>   Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
> Press [q] to stop, [?] for help
> Output #0, mp4, to '<path>/alphatest.mp4':
>   Metadata:
>     encoder         : Lavf59.17.100
>   Chapters:
>     Chapter #0:0: start 0.000000, end 76.033611
>       Metadata:
>         title           : Chapter 1
>     Chapter #0:1: start 76.033611, end 300.000000
>       Metadata:
>         title           : Chapter 2
>   Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 23.98 fps, 14002 tbn
>     Metadata:
>       encoder         : Lavc59.20.100 mpeg4
>     Side data:
>       cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
>   Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
>     Metadata:
>       title           : English Audio - <title>
>       encoder         : Lavc59.20.100 aac
> frame= 7193 fps= 55 q=1.0 Lsize=  463935kB time=00:05:00.01 bitrate=12668.1kbits/s speed=2.31x
> video:457767kB audio:6016kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.032624%
> [aac @ 0x55f68e9132c0] Qavg: 118.000
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list