[FFmpeg-user] gif overlay miscalculating x and y, extra frame flash

Michael Koch astroelectronic at t-online.de
Mon Feb 10 03:03:22 EET 2020


Am 09.02.2020 um 23:51 schrieb S Andreason:
> Hi,
> I continued building and rendering after asking some questions last 
> week. After 6 days x10 hours per day of 
> (render,test,measure,edit,repeat) I finally was able to publish my 
> video. In doing so I made it easy to duplicate the bugs I have been 
> seeing.
>
> I have put the 7 files together in one 56Mb package for you to 
> download at
> https://www.seahorsecorral.org/videos/tests/ffmpeg-test-gif.zip
>
> The issue is with -i gif and 
> overlay=x=(calculations):y=(calculations):between
> 1. between calculates n differently than the 30fps video,
> 2. the last calculation for x and y are held over in memory for the 
> next overlay, resulting in offsets and drift over time.

I have a similar problem, not sure if it's the same as yours, but it's 
easier to reproduce.
A small black rectangle is overlaid over a video, and its position is 
shifted to the right by one pixel per second. Theoretically we should 
see 9 steps in the 10s video. But I see only 4 steps, in 2s intervals.

ffmpeg -f lavfi -i testsrc2=size=vga -f lavfi -i color=black:size=20x40 
-lavfi overlay=x=400+t:y=200 -c:v mpeg4 -q:v 0 -y -t 10 out.mp4

The console output is below.

Michael


C:\Users\mKoch\Desktop>c:\ffmpeg\ffmpeg -f lavfi -i testsrc2=size=vga -f 
lavfi -
i color=black:size=20x40 -lavfi overlay=x=400+t:y=200 -c:v mpeg4 -q:v 0 
-y -t 10
  out.mp4
ffmpeg version git-2020-02-06-343ccfc Copyright (c) 2000-2020 the FFmpeg 
develop
ers
   built with gcc 9.2.1 (GCC) 20200122
   configuration: --enable-gpl --enable-version3 --enable-sdl2 
--enable-fontconfi
g --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d 
--enable-libb
luray --enable-libfreetype --enable-libmp3lame 
--enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus 
--enable-libshine --e
nable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame 
--enable
-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 
--enable-libx265 -
-enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib 
--enable-gmp --enab
le-libvidstab --enable-libvorbis --enable-libvo-amrwbenc 
--enable-libmysofa --en
able-libspeex --enable-libxvid --enable-libaom --enable-libmfx 
--enable-ffnvcode
c --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec 
--enable-dxva2 -
-enable-avisynth --enable-libopenmpt --enable-amf
   libavutil      56. 39.100 / 56. 39.100
   libavcodec     58. 68.100 / 58. 68.100
   libavformat    58. 38.100 / 58. 38.100
   libavdevice    58.  9.103 / 58.  9.103
   libavfilter     7. 74.100 /  7. 74.100
   libswscale      5.  6.100 /  5.  6.100
   libswresample   3.  6.100 /  3.  6.100
   libpostproc    55.  6.100 / 55.  6.100
Input #0, lavfi, from 'testsrc2=size=vga':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 640x480 
[SAR 1:1
DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Input #1, lavfi, from 'color=black:size=20x40':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #1:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 20x40 
[SAR 1:1 DA
R 1:2], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
   Stream #0:0 (rawvideo) -> overlay:main
   Stream #1:0 (rawvideo) -> overlay:overlay
   overlay -> Stream #0:0 (mpeg4)
Press [q] to stop, [?] for help
Output #0, mp4, to 'out.mp4':
   Metadata:
     encoder         : Lavf58.38.100
     Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 640x480 
[SAR 1:1 DAR
  4:3], q=2-31, 200 kb/s, 25 fps, 12800 tbn, 25 tbc (default)
     Metadata:
       encoder         : Lavc58.68.100 mpeg4
     Side data:
       cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=  250 fps=0.0 q=0.0 Lsize=    6089kB time=00:00:09.96 
bitrate=5007.8kbits/
s speed=30.5x
video:6087kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB 
muxing
overhead: 0.032490%




More information about the ffmpeg-user mailing list