Opened 3 hours ago

Last modified 3 hours ago

#11231 new defect

alphamerge complex filter delays video several seconds

Reported by: degradox Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: using complex filter with alphamerge caused audio-video desync.

How to reproduce:
When converting normally, the output has audio and video synced, like the input:

% ffmpeg -y -i input_good.mp4 -map 0:v -map 0:a -c:v libx264 -profile:v high -level:v 4.2 -pix_fmt yuv420p \
  -r 60 -b:v 600k -preset fast -c:a aac -b:a 80k -ar 48000 -ac 2 -fps_mode cfr -nostdin output_good.mp4

Using filter advances somehow the video. The first minutes it's about 7 seconds. At the end the video ends about 13 seconds earlier than audio, so there's the last frame stuck for that time:

% ffmpeg -y \
  -i input_good.mp4 \
  -filter_complex "\
    [0:v]scale=1920:1080:force_original_aspect_ratio=decrease,setpts=PTS-STARTPTS [scaled_main]; \
    color=c=black@0:s=1280x720:d=10000 [blank_overlay]; \
    [blank_overlay]format=gray [mask_trim]; \
    [blank_overlay][mask_trim]alphamerge [overlay_stream]; \
    [scaled_main][overlay_stream]overlay=x=main_w-overlay_w-0:y=main_h-overlay_h-0:eof_action=pass:shortest=0 [outv]" \
  -map "[outv]" -map 0:a -c:v libx264 -profile:v high -level:v 4.2 -pix_fmt yuv420p -r 60 -b:v 600k -preset fast \
  -c:a aac -b:a 80k -ar 48000 -ac 2 -fps_mode cfr -nostdin output_desynced.mp4

Both outputs have the same duration as the input, 51 minutes 54 seconds.

Attachments (2)

output_good.log (150.7 KB ) - added by degradox 3 hours ago.
output_desynced.log (373.7 KB ) - added by degradox 3 hours ago.

Download all attachments as: .zip

Change History (3)

comment:1 by degradox, 3 hours ago

Sample and output files are all here:
https://mega.nz/folder/YKAAGLiK#12KyX41EFsOMIXnMEYqCbA

by degradox, 3 hours ago

Attachment: output_good.log added

by degradox, 3 hours ago

Attachment: output_desynced.log added
Note: See TracTickets for help on using tickets.