1
1
I'm getting desperate trying to figure out why ffmpeg overlay filter misbehaves
I have the following ffmpeg command
ffmpeg -loop 1 -r 60 -i ./tmp/tmp0.jpg -loop 1 -r 60 -i ./tmp/tmp1.jpg -y -filter_complex
[0]trim=duration=5[0_trim0];
[0_trim0]scale=width=1280:height=-1[0_scale1];
[0_scale1]setsar=sar=1[0_setsar2];
[0_setsar2]crop=out_w=1280:out_h=720:x=0:y=(in_h - 720) / 2[0_setsar2_crop0];
[0_setsar2_crop0]setsar=sar=1[0_setsar3];
[0_setsar3]split=2[fl0_r0][fl0_r1];
[1]trim=duration=2[1_trim0];
[1_trim0]scale=width=1280:height=-1[1_scale1];
[1_scale1]setsar=sar=1[1_setsar2];
[1_setsar2]crop=out_w=1280:out_h=720:x=0:y=(in_h - 720) / 2[1_setsar2_crop0];
[1_setsar2_crop0]setsar=sar=1[1_setsar3];
[1_setsar3]split=2[fl1_r0][fl1_r1];
[fl0_r0]setpts=PTS-STARTPTS[fl0_r0_];
[fl1_r0]setpts=PTS-STARTPTS[fl1_r0_];
[fl0_r0_][fl1_r0_]overlay=x='if(lte(x, (main_w - overlay_w) / 2), -overlay_w + t / 5 * (overlay_w + (main_w - overlay_w) / 2), (main_w - overlay_w) / 2)'[tr0_overlay];
[tr0_overlay]trim=duration=5[tr0];
[fl0_r1][tr0][fl1_r1]concat=n=3:v=1[vt]
-map [vt] -acodec libmp3lame -r 60 -vcodec libx264 -f mp4 -pix_fmt yuv420p -preset fast -crf 20 ./tmp/output.mp4
(It's padded for better visibility)
What am I trying to do?
- show 1st image for 5 seconds(arbitrary number)
- slide 2nd image over 1st image from the left to the right for 5 seconds(arbitrary number, can be 1, can be 10 - should not depend on the length of 1st and 2nd input streams)
- show 2nd image for 2 seconds(arbitrary number)
What do I get?
I've tried various solutions, with this one 2nd image moves above 1st image just for the 1st second and then abruptly stops for the next 4 seconds after which instantly jumps to the end of animation
while ffmpeg spams lots of warning
frame= 98 fps=8.1 q=28.0 size= 144kB time=00:00:01.08 bitrate=1087.8kbits/
[Parsed_overlay_14 @ 0x30d6400] [framesync @ 0x30d64e8] Buffer queue overflow, d ropping
I suspect there is some issue with frames timelines, but so far I had no success If I add setpts filter 5*PTS - it works perfectly but I observe 5x frame drop(from 60 fps down to 12 fps) taken from: https://ffmpeg.org/ffmpeg-filters.html#Examples-88 (slow motion)
For some reason overlay filter works only with the 1st second of the video - no matter what I'm trying to do
I also tried to combine fps and setpts filter as a kind of weird hack - no success
ffmpeg version:
ffmpeg version N-76045-g97be5d4 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
Probably I'm missing something obvious! Please help...
Could this be related? https://trac.ffmpeg.org/ticket/4950
– let4be – 2015-11-18T11:29:34.753