Opened 13 months ago

Last modified 13 months ago

#8900 new defect

ffmpeg generates a file which it rejexts as input with "Too many packets buffered for output stream"

Reported by: monnier Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: monnier@iro.umontreal.ca Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description

Summary of the bug: When I use ffmpeg to extract a chunk of a video, the resulting video is played correctly by Totem but is not accepted as input by ffmpeg, giving me "Too many packets buffered for output stream"
How to reproduce:

% ffmpeg -i sample.webm -vcodec copy -acodec copy -ss 06:00 -to 07:00 broken.webm; ffmpeg -i broken.webm copy.webm
ffmpeg version 4.3.1-2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10 (Debian 10.2.0-5)
  configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/i386-linux-gnu --incdir=/usr/include/i386-linux-gnu --arch=i386 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --ignore-tests='hapenc-hap-none,hapenc-hapa-none,hapenc-hapq-none' --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, matroska,webm, from 'sample.webm':
  Metadata:
    encoder         : GStreamer matroskamux version 1.16.2
    creation_time   : 2020-07-03T23:24:15.000000Z
  Duration: 00:08:13.60, start: 0.000000, bitrate: 82 kb/s
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 887x702, SAR 1:1 DAR 887:702, 10 fps, 10 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      title           : Video
    Stream #0:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
    Metadata:
      title           : Audio
Output #0, webm, to 'broken.webm':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 887x702 [SAR 1:1 DAR 887:702], q=2-31, 10 fps, 10 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      title           : Video
    Stream #0:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
    Metadata:
      title           : Audio
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  488 fps=0.0 q=-1.0 Lsize=     536kB time=00:00:59.98 bitrate=  73.2kbits/s speed= 570x    
video:190kB audio:320kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 4.990967%
ffmpeg version 4.3.1-2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10 (Debian 10.2.0-5)
  configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/i386-linux-gnu --incdir=/usr/include/i386-linux-gnu --arch=i386 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --ignore-tests='hapenc-hap-none,hapenc-hapa-none,hapenc-hapq-none' --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, matroska,webm, from 'broken.webm':
  Metadata:
    ENCODER         : Lavf58.45.100
  Duration: 00:01:00.01, start: 0.018000, bitrate: 73 kb/s
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 887x702, SAR 1:1 DAR 887:702, 10 fps, 10 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      title           : Video
      DURATION        : 00:01:00.000000000
    Stream #0:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
    Metadata:
      title           : Audio
      DURATION        : 00:01:00.010000000
Stream mapping:
  Stream #0:0 -> #0:0 (vp8 (native) -> vp9 (libvpx-vp9))
  Stream #0:1 -> #0:1 (vorbis (native) -> opus (libopus))
Press [q] to stop, [?] for help
[libopus @ 0x5835f000] No bit rate set. Defaulting to 96000 bps.
Too many packets buffered for output stream 0:1.
[libopus @ 0x5835f000] 1 frames left in the queue on closing
Conversion failed!

This is on Debian testing on i386 using Debian's build of ffmpeg

Attachments (1)

sample2.webm (1.9 MB ) - added by monnier 13 months ago.

Download all attachments as: .zip

Change History (5)

by monnier, 13 months ago

Attachment: sample2.webm added

comment:1 by monnier, 13 months ago

Note: My sample.webm was too big, so I had to upload a shorter version of it, so you need to adjust the times parameters in my recipe for the chunk to extract. It should now be -ss 01:00 -to 02:00.

Last edited 13 months ago by monnier (previous) (diff)

comment:2 by monnier, 13 months ago

Cc: monnier@iro.umontreal.ca added

comment:3 by mkver, 13 months ago

Analyzed by developer: set

You are streamcopying the first sample and therefore you have to live with the positions of the keyframes. The first keyframe of your sample after 1:00 is at 1:04 and the first keyframe of broken.mkv is at 4s. Before this keyframe are about 200 audio packets. They don't all fit into ffmpeg's muxing queue when using the default size for the muxing queue (which is 128). You can add -max_muxing_queue_size 256 as a workaround.

comment:4 by monnier, 13 months ago

I can't add any special argument to the second ffmpeg run because it's not under my control (it's done by Peertube). I guess I could avoid the problem if I could re-run the first command without the copy codec, but in my real case I don't have the original uncut file, So the question becomes how to generate a file from broken.webm which does not suffer from this problem. I assume it will require some amount of re-encoding, but just doing ffmpeg -i broken.webm -max_muxing_queue_size 256 unbroken.webm doesn't do the trick (the result still suffers from the same problem).

It would be *very* helpful for ffmpeg to emit a loud warning when it is asked to *generate* a file which will suffer from the "Too many packets buffered for output stream" problem.

Last edited 13 months ago by monnier (previous) (diff)
Note: See TracTickets for help on using tickets.