[FFmpeg-trac] #2467(avfilter:new): -itsoffset with overlay filter buffer queue overflow

FFmpeg trac at avcodec.org
Sat Apr 13 17:07:04 CEST 2013


#2467: -itsoffset with overlay filter buffer queue overflow
------------------------------------+------------------------------------
             Reporter:  Timbot      |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avfilter
              Version:  git-master  |               Resolution:
             Keywords:              |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------

Old description:

> Summary of the bug:
> When attempting to overlay a video on another video, use of -itsoffset to
> delay the start of the overlay results in buffer queue overflow errors
> and dropped frames. Video is unusable.
>
> I have tried with libx264 encoded mp4 files, as well as mpg and mov files
> and the problem is recreated every time.
>
> Use of -itsoffset without the overlay filter seems to work as expected.
>
> How to reproduce:
>
> ffmpeg -i greenscreen2.mp4 -itsoffset 2 -i hero.mp4 -filter_complex
> '[1:0]scale=iw/2:ih/2[out];[0:0][out]overlay' -report -y mytest.mp4
> ffmpeg started on 2013-04-13 at 14:53:35
> Report written to "ffmpeg-20130413-145335.log"
> ffmpeg version N-37415-g9b672d4 Copyright (c) 2000-2013 the FFmpeg
> developers
>   built on Apr 13 2013 13:53:49 with gcc 4.6.1 (Ubuntu/Linaro
> 4.6.1-9ubuntu3)
>   configuration: --enable-gpl --enable-libass --enable-libfaac --enable-
> libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-
> libopencore-amrwb --enable-libspeex --enable-librtmp --enable-libtheora
> --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
> --enable-version3 --enable-libfreetype --enable-filter=drawtext
>   libavutil      52. 26.100 / 52. 26.100
>   libavcodec     55.  2.100 / 55.  2.100
>   libavformat    55.  2.100 / 55.  2.100
>   libavdevice    55.  0.100 / 55.  0.100
>   libavfilter     3. 53.101 /  3. 53.101
>   libswscale      2.  2.100 /  2.  2.100
>   libswresample   0. 17.102 /  0. 17.102
>   libpostproc    52.  3.100 / 52.  3.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'greenscreen2.mp4':
>   Metadata:
>     major_brand     : mp42
>     minor_version   : 0
>     compatible_brands: mp42mp41
>     creation_time   : 2013-03-30 17:54:38
>   Duration: 00:00:32.85, start: 0.000000, bitrate: 4961 kb/s
>     Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
> 1280x720 [SAR 1:1 DAR 16:9], 4769 kb/s, 29.97 fps, 29.97 tbr, 30k tbn,
> 59.94 tbc
>     Metadata:
>       creation_time   : 2013-03-30 17:54:38
>       handler_name    : ?Mainconcept Video Media Handler
>     Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
> fltp, 189 kb/s
>     Metadata:
>       creation_time   : 2013-03-30 17:54:38
>       handler_name    : #Mainconcept MP4 Sound Media Handler
> Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'hero.mp4':
>   Metadata:
>     major_brand     : mp42
>     minor_version   : 0
>     compatible_brands: mp42mp41
>     creation_time   : 2012-04-12 18:15:14
>   Duration: 00:00:06.00, start: 0.033333, bitrate: 610 kb/s
>     Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
> 1280x720 [SAR 1:1 DAR 16:9], 598 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc
>     Metadata:
>       creation_time   : 2012-04-12 18:15:14
>       handler_name    : Mainconcept MP4 Video Media Handler
> [Parsed_scale_0 @ 0x3280be0] w:iw/2 h:ih/2 flags:'bilinear' interl:0
> [graph 0 input from stream 1:0 @ 0x327f1c0] w:1280 h:720 pixfmt:yuv420p
> tb:1/30000 fr:30/1 sar:1/1 sws_param:flags=2
> [graph 0 input from stream 0:0 @ 0x3405a40] w:1280 h:720 pixfmt:yuv420p
> tb:1/30000 fr:30000/1001 sar:1/1 sws_param:flags=2
> [Parsed_scale_0 @ 0x3280be0] w:1280 h:720 fmt:yuv420p sar:1/1 -> w:640
> h:360 fmt:yuva420p sar:1/1 flags:0x2
> [Parsed_overlay_1 @ 0x327f280] main w:1280 h:720 fmt:yuv420p overlay
> w:640 h:360 fmt:yuva420p
> [graph 1 input from stream 0:1 @ 0x3269b60] tb:1/48000 samplefmt:fltp
> samplerate:48000 chlayout:0x3
> [audio format for output stream 0:1 @ 0x3428520] auto-inserting filter
> 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the
> filter 'audio format for output stream 0:1'
> [auto-inserted resampler 0 @ 0x3422be0] ch:2 chl:stereo fmt:fltp
> r:48000Hz -> ch:2 chl:stereo fmt:s16 r:48000Hz
> [libx264 @ 0x329acc0] using SAR=1/1
> [libx264 @ 0x329acc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1
> Cache64
> [libx264 @ 0x329acc0] profile High, level 3.1
> [libx264 @ 0x329acc0] 264 - core 130 r2 c832fe9 - H.264/MPEG-4 AVC codec
> - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options:
> cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
> psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1
> cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12
> lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
> bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
> b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25
> scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
> qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
> Output #0, mp4, to 'mytest.mp4':
>   Metadata:
>     major_brand     : mp42
>     minor_version   : 0
>     compatible_brands: mp42mp41
>     encoder         : Lavf55.2.100
>     Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720
> [SAR 1:1 DAR 16:9], q=-1--1, 30k tbn, 29.97 tbc
>     Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz,
> stereo, s16, 128 kb/s
>     Metadata:
>       creation_time   : 2013-03-30 17:54:38
>       handler_name    : #Mainconcept MP4 Sound Media Handler
> Stream mapping:
>   Stream #0:0 (h264) -> overlay:main (graph 0)
>   Stream #1:0 (h264) -> scale (graph 0)
>   overlay (graph 0) -> Stream #0:0 (libx264)
>   Stream #0:1 -> #0:1 (aac -> libfaac)
> Press [q] to stop, [?] for help
> Buffer queue overflow, dropping.     115kB time=00:00:02.28 bitrate=
> 412.9kbits/s
> [Parsed_overlay_1 @ 0x327f280] Buffer queue overflow, dropping.
>     Last message repeated 36 times
> *** 38 dup! fps= 59 q=29.0 size=     161kB time=00:00:04.77 bitrate=
> 275.8kbits/s
> Buffer queue overflow, dropping.     339kB time=00:00:04.77 bitrate=
> 580.3kbits/s dup=38 drop=0
> [Parsed_overlay_1 @ 0x327f280] Buffer queue overflow, dropping.
>     Last message repeated 38 times
> No more output streams to write to, finishing.e=00:00:31.61 bitrate=
> 801.2kbits/s dup=38 drop=0
> frame=  983 fps= 77 q=32766.0 Lsize=    3178kB time=00:00:32.85 bitrate=
> 792.4kbits/s dup=38 drop=0
> video:2634kB audio:508kB subtitle:0 global headers:0kB muxing overhead
> 1.157666%
> [libx264 @ 0x329acc0] frame I:4     Avg QP:18.73  size: 49240
> [libx264 @ 0x329acc0] frame P:289   Avg QP:18.56  size:  5803
> [libx264 @ 0x329acc0] frame B:690   Avg QP:21.98  size:  1192
> [libx264 @ 0x329acc0] consecutive B-frames:  4.5%  5.5%  0.9% 89.1%
> [libx264 @ 0x329acc0] mb I  I16..4: 41.0% 37.7% 21.3%
> [libx264 @ 0x329acc0] mb P  I16..4:  3.2%  4.2%  1.1%  P16..4:  9.9%
> 3.0%  1.6%  0.0%  0.0%    skip:77.0%
> [libx264 @ 0x329acc0] mb B  I16..4:  0.3%  0.4%  0.0%  B16..8:  8.8%
> 1.1%  0.1%  direct: 0.4%  skip:88.9%  L0:44.1% L1:49.4% BI: 6.5%
> [libx264 @ 0x329acc0] 8x8 transform intra:48.6% inter:77.5%
> [libx264 @ 0x329acc0] coded y,uvDC,uvAC intra: 39.0% 48.1% 18.3% inter:
> 2.5% 3.2% 0.4%
> [libx264 @ 0x329acc0] i16 v,h,dc,p: 58% 19%  8% 15%
> [libx264 @ 0x329acc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 21% 23%  5%  5%
> 6%  6%  6%  7%
> [libx264 @ 0x329acc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 18% 18%  4%  6%
> 6%  6%  5%  4%
> [libx264 @ 0x329acc0] i8c dc,h,v,p: 61% 19% 15%  5%
> [libx264 @ 0x329acc0] Weighted P-Frames: Y:3.5% UV:3.5%
> [libx264 @ 0x329acc0] ref P L0: 60.2% 13.6% 17.7%  8.3%  0.2%
> [libx264 @ 0x329acc0] ref B L0: 89.1%  9.3%  1.6%
> [libx264 @ 0x329acc0] ref B L1: 96.3%  3.7%
> [libx264 @ 0x329acc0] kb/s:657.71
>
> I will attach the full report log.

New description:

 Summary of the bug:
 When attempting to overlay a video on another video, use of -itsoffset to
 delay the start of the overlay results in buffer queue overflow errors and
 dropped frames. Video is unusable.

 I have tried with libx264 encoded mp4 files, as well as mpg and mov files
 and the problem is recreated every time.

 Use of -itsoffset without the overlay filter seems to work as expected.

 How to reproduce:
 {{{
 ffmpeg -i greenscreen2.mp4 -itsoffset 2 -i hero.mp4 -filter_complex
 '[1:0]scale=iw/2:ih/2[out];[0:0][out]overlay' -report -y mytest.mp4
 ffmpeg started on 2013-04-13 at 14:53:35
 Report written to "ffmpeg-20130413-145335.log"
 ffmpeg version N-37415-g9b672d4 Copyright (c) 2000-2013 the FFmpeg
 developers
   built on Apr 13 2013 13:53:49 with gcc 4.6.1 (Ubuntu/Linaro
 4.6.1-9ubuntu3)
   configuration: --enable-gpl --enable-libass --enable-libfaac --enable-
 libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-
 libopencore-amrwb --enable-libspeex --enable-librtmp --enable-libtheora
 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
 --enable-version3 --enable-libfreetype --enable-filter=drawtext
   libavutil      52. 26.100 / 52. 26.100
   libavcodec     55.  2.100 / 55.  2.100
   libavformat    55.  2.100 / 55.  2.100
   libavdevice    55.  0.100 / 55.  0.100
   libavfilter     3. 53.101 /  3. 53.101
   libswscale      2.  2.100 /  2.  2.100
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  3.100 / 52.  3.100
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'greenscreen2.mp4':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: mp42mp41
     creation_time   : 2013-03-30 17:54:38
   Duration: 00:00:32.85, start: 0.000000, bitrate: 4961 kb/s
     Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
 1280x720 [SAR 1:1 DAR 16:9], 4769 kb/s, 29.97 fps, 29.97 tbr, 30k tbn,
 59.94 tbc
     Metadata:
       creation_time   : 2013-03-30 17:54:38
       handler_name    : ?Mainconcept Video Media Handler
     Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
 fltp, 189 kb/s
     Metadata:
       creation_time   : 2013-03-30 17:54:38
       handler_name    : #Mainconcept MP4 Sound Media Handler
 Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'hero.mp4':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: mp42mp41
     creation_time   : 2012-04-12 18:15:14
   Duration: 00:00:06.00, start: 0.033333, bitrate: 610 kb/s
     Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
 1280x720 [SAR 1:1 DAR 16:9], 598 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc
     Metadata:
       creation_time   : 2012-04-12 18:15:14
       handler_name    : Mainconcept MP4 Video Media Handler
 [Parsed_scale_0 @ 0x3280be0] w:iw/2 h:ih/2 flags:'bilinear' interl:0
 [graph 0 input from stream 1:0 @ 0x327f1c0] w:1280 h:720 pixfmt:yuv420p
 tb:1/30000 fr:30/1 sar:1/1 sws_param:flags=2
 [graph 0 input from stream 0:0 @ 0x3405a40] w:1280 h:720 pixfmt:yuv420p
 tb:1/30000 fr:30000/1001 sar:1/1 sws_param:flags=2
 [Parsed_scale_0 @ 0x3280be0] w:1280 h:720 fmt:yuv420p sar:1/1 -> w:640
 h:360 fmt:yuva420p sar:1/1 flags:0x2
 [Parsed_overlay_1 @ 0x327f280] main w:1280 h:720 fmt:yuv420p overlay w:640
 h:360 fmt:yuva420p
 [graph 1 input from stream 0:1 @ 0x3269b60] tb:1/48000 samplefmt:fltp
 samplerate:48000 chlayout:0x3
 [audio format for output stream 0:1 @ 0x3428520] auto-inserting filter
 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the
 filter 'audio format for output stream 0:1'
 [auto-inserted resampler 0 @ 0x3422be0] ch:2 chl:stereo fmt:fltp r:48000Hz
 -> ch:2 chl:stereo fmt:s16 r:48000Hz
 [libx264 @ 0x329acc0] using SAR=1/1
 [libx264 @ 0x329acc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1
 Cache64
 [libx264 @ 0x329acc0] profile High, level 3.1
 [libx264 @ 0x329acc0] 264 - core 130 r2 c832fe9 - H.264/MPEG-4 AVC codec -
 Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1
 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1
 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12
 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25
 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 Output #0, mp4, to 'mytest.mp4':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: mp42mp41
     encoder         : Lavf55.2.100
     Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720
 [SAR 1:1 DAR 16:9], q=-1--1, 30k tbn, 29.97 tbc
     Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz,
 stereo, s16, 128 kb/s
     Metadata:
       creation_time   : 2013-03-30 17:54:38
       handler_name    : #Mainconcept MP4 Sound Media Handler
 Stream mapping:
   Stream #0:0 (h264) -> overlay:main (graph 0)
   Stream #1:0 (h264) -> scale (graph 0)
   overlay (graph 0) -> Stream #0:0 (libx264)
   Stream #0:1 -> #0:1 (aac -> libfaac)
 Press [q] to stop, [?] for help
 Buffer queue overflow, dropping.     115kB time=00:00:02.28 bitrate=
 412.9kbits/s
 [Parsed_overlay_1 @ 0x327f280] Buffer queue overflow, dropping.
     Last message repeated 36 times
 *** 38 dup! fps= 59 q=29.0 size=     161kB time=00:00:04.77 bitrate=
 275.8kbits/s
 Buffer queue overflow, dropping.     339kB time=00:00:04.77 bitrate=
 580.3kbits/s dup=38 drop=0
 [Parsed_overlay_1 @ 0x327f280] Buffer queue overflow, dropping.
     Last message repeated 38 times
 No more output streams to write to, finishing.e=00:00:31.61 bitrate=
 801.2kbits/s dup=38 drop=0
 frame=  983 fps= 77 q=32766.0 Lsize=    3178kB time=00:00:32.85 bitrate=
 792.4kbits/s dup=38 drop=0
 video:2634kB audio:508kB subtitle:0 global headers:0kB muxing overhead
 1.157666%
 [libx264 @ 0x329acc0] frame I:4     Avg QP:18.73  size: 49240
 [libx264 @ 0x329acc0] frame P:289   Avg QP:18.56  size:  5803
 [libx264 @ 0x329acc0] frame B:690   Avg QP:21.98  size:  1192
 [libx264 @ 0x329acc0] consecutive B-frames:  4.5%  5.5%  0.9% 89.1%
 [libx264 @ 0x329acc0] mb I  I16..4: 41.0% 37.7% 21.3%
 [libx264 @ 0x329acc0] mb P  I16..4:  3.2%  4.2%  1.1%  P16..4:  9.9%  3.0%
 1.6%  0.0%  0.0%    skip:77.0%
 [libx264 @ 0x329acc0] mb B  I16..4:  0.3%  0.4%  0.0%  B16..8:  8.8%  1.1%
 0.1%  direct: 0.4%  skip:88.9%  L0:44.1% L1:49.4% BI: 6.5%
 [libx264 @ 0x329acc0] 8x8 transform intra:48.6% inter:77.5%
 [libx264 @ 0x329acc0] coded y,uvDC,uvAC intra: 39.0% 48.1% 18.3% inter:
 2.5% 3.2% 0.4%
 [libx264 @ 0x329acc0] i16 v,h,dc,p: 58% 19%  8% 15%
 [libx264 @ 0x329acc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 21% 23%  5%  5%
 6%  6%  6%  7%
 [libx264 @ 0x329acc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 18% 18%  4%  6%
 6%  6%  5%  4%
 [libx264 @ 0x329acc0] i8c dc,h,v,p: 61% 19% 15%  5%
 [libx264 @ 0x329acc0] Weighted P-Frames: Y:3.5% UV:3.5%
 [libx264 @ 0x329acc0] ref P L0: 60.2% 13.6% 17.7%  8.3%  0.2%
 [libx264 @ 0x329acc0] ref B L0: 89.1%  9.3%  1.6%
 [libx264 @ 0x329acc0] ref B L1: 96.3%  3.7%
 [libx264 @ 0x329acc0] kb/s:657.71
 }}}
 I will attach the full report log.

--

Comment (by cehoyos):

 Is this only reproducible using external libraries (libx264, libfaac) or
 also with native encoders?

 Please point to (or provide) sample input files.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2467#comment:1>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list