Skip to content
This repository has been archived by the owner on Dec 23, 2022. It is now read-only.

FFmpeg Convert Error Too many packets buffered for output stream 0:1. #130

Open
mcachirag opened this issue May 22, 2019 · 7 comments
Open

Comments

@mcachirag
Copy link

I just simply convert one file to other and i got error from ffmpeg "Too many packets buffered for output stream 0:1."

here is the command i use.
-y -i /storage/emulated/0/videos/video6.mp4 -preset ultrafast -strict -2 -c:v libx264 -c:a aac -pix_fmt yuv420p /storage/emulated/0/DCIM/VideoEditorVideo/video6.mp4

i am able to convert other file with same command only for some video i got error.

Please help to resolve this.

@invisiblek
Copy link

#128

@FallingSnow
Copy link
Owner

Are you guys using the latest version of ffmpeg?

What does ffmpeg -version return?`

@invisiblek
Copy link

@FallingSnow when I wrote the patch a few months back I was using the latest ffmpeg available in arch repos at that time. For reference: #91 (comment)

I haven't tried h265ize without my patch since then. If it's been fixed in upstream ffmpeg, I wouldn't know.

@FallingSnow
Copy link
Owner

My first preliminary search lead to results that this bug had been fixed long ago. Please ensure your ffmpeg versions are up to date.

@mbergstrand
Copy link

ffmpeg version 4.1.3-0ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Ubuntu 8.3.0-6ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --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-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --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-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264
--enable-shared
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100

@MrManny
Copy link

MrManny commented Aug 28, 2019

I have a similar issue. I am not sure if the root cause is related, but the error message was very similar, so I will put it in here for reference. I originally noticed the issue today with ffmpeg 4.1, but just to be safe, I grabbed zeranoe's static win-x64 build for 4.2.

C:\Users\WarumM\Desktop>ffmpeg -version
ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190807
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-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 --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil      56. 31.100 / 56. 31.100
libavcodec     58. 54.100 / 58. 54.100
libavformat    58. 29.100 / 58. 29.100
libavdevice    58.  8.100 / 58.  8.100
libavfilter     7. 57.100 /  7. 57.100
libswscale      5.  5.100 /  5.  5.100
libswresample   3.  5.100 /  3.  5.100
libpostproc    55.  5.100 / 55.  5.100

(Note: the pasted stdout stuff below is still from 4.1, but I have verified that they are essentially equal when running with 4.2).

I was trying to h265ize a timelapse recording from my GoPro Hero7. In my case, the problem seems to be revolving around data streams that GoPro has injected.

C:\Users\WarumM\Desktop>h265ize --debug GH010122_1566977284213_high.MP4
[h265ize]: [debug] Log file location: C:\Users\WarumM\Desktop\h265ize.log
[h265ize]: [verbose] Handling keypresses...
[h265ize]: [verbose] Setting as-preset options...
[h265ize]: Processing GH010122_1566977284213_high.MP4...
--------------------------------------------------------------------------------

[h265ize]: [verbose] Encoding started at Wed, 1:13 PM
[h265ize]: [debug] Path: GH010122_1566977284213_high.MP4
[h265ize]: [verbose] Getting metadata...
[h265ize]: [debug] Container data:
        - duration: 00:02:36
        - size: 1.1 GB
[h265ize]: [verbose] Resolving video streams...
[h265ize]: [debug] Working on stream:
[h265ize]: [debug] Working on stream: 1
[h265ize]: [debug] Working on stream: 2
[h265ize]: [debug] Working on stream: 3
[h265ize]: [verbose] Upconverting...
[h265ize]: [debug] Upconverting 0 tracks.
[h265ize]: [verbose] Setting video bit depth...
[h265ize]: [verbose] Mapping streams...
[h265ize]: [debug] Video stream 0:0 mapped.
        - size: 3840x2160
        - codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
        - profile: High
        - bit depth: 8
[h265ize]: [debug] Other stream 0:1 mapped.
[h265ize]: [debug] Other stream 0:2 mapped.
[h265ize]: [debug] Other stream 0:3 mapped.
[h265ize]: [verbose] Detecting auto crop...
[h265ize]: Crop Detection: 1/12
[h265ize]: [debug] Running Query: ffmpeg -ss 144.6675996923077 -i GH010122_1566977284213_high.MP4 -y -vframes 2 -filter:v cropdetect=0.094:16:0 -map 0:0 -f null -
[h265ize]: Crop Detection: 2/12
[h265ize]: [debug] Running Query: ffmpeg -ss 132.61196638461539 -i GH010122_1566977284213_high.MP4 -y -vframes 2 -filter:v cropdetect=0.094:16:0 -map 0:0 -f null -
[h265ize]: Crop Detection: 3/12
[h265ize]: [debug] Running Query: ffmpeg -ss 120.55633307692307 -i GH010122_1566977284213_high.MP4 -y -vframes 2 -filter:v cropdetect=0.094:16:0 -map 0:0 -f null -
[h265ize]: Crop Detection: 4/12
[h265ize]: [debug] Running Query: ffmpeg -ss 108.50069976923076 -i GH010122_1566977284213_high.MP4 -y -vframes 2 -filter:v cropdetect=0.094:16:0 -map 0:0 -f null -
[h265ize]: Crop Detection: 5/12
[h265ize]: [debug] Running Query: ffmpeg -ss 96.44506646153846 -i GH010122_1566977284213_high.MP4 -y -vframes 2 -filter:v cropdetect=0.094:16:0 -map 0:0 -f null -
[h265ize]: Crop Detection: 6/12
[h265ize]: [debug] Running Query: ffmpeg -ss 84.38943315384616 -i GH010122_1566977284213_high.MP4 -y -vframes 2 -filter:v cropdetect=0.094:16:0 -map 0:0 -f null -
[h265ize]: Crop Detection: 7/12
[h265ize]: [debug] Running Query: ffmpeg -ss 72.33379984615385 -i GH010122_1566977284213_high.MP4 -y -vframes 2 -filter:v cropdetect=0.094:16:0 -map 0:0 -f null -
[h265ize]: Crop Detection: 8/12
[h265ize]: [debug] Running Query: ffmpeg -ss 60.278166538461534 -i GH010122_1566977284213_high.MP4 -y -vframes 2 -filter:v cropdetect=0.094:16:0 -map 0:0 -f null -
[h265ize]: Crop Detection: 9/12
[h265ize]: [debug] Running Query: ffmpeg -ss 48.22253323076923 -i GH010122_1566977284213_high.MP4 -y -vframes 2 -filter:v cropdetect=0.094:16:0 -map 0:0 -f null -
[h265ize]: Crop Detection: 10/12
[h265ize]: [debug] Running Query: ffmpeg -ss 36.166899923076926 -i GH010122_1566977284213_high.MP4 -y -vframes 2 -filter:v cropdetect=0.094:16:0 -map 0:0 -f null -
[h265ize]: Crop Detection: 11/12
[h265ize]: [debug] Running Query: ffmpeg -ss 24.111266615384615 -i GH010122_1566977284213_high.MP4 -y -vframes 2 -filter:v cropdetect=0.094:16:0 -map 0:0 -f null -
[h265ize]: Crop Detection: 12/12
[h265ize]: [debug] Running Query: ffmpeg -ss 12.055633307692307 -i GH010122_1566977284213_high.MP4 -y -vframes 2 -filter:v cropdetect=0.094:16:0 -map 0:0 -f null -
[h265ize]: [verbose] Mapping HE Audio streams...
[h265ize]: [verbose] Setting ffmpeg settings...
[h265ize]: [verbose] Encoding video...
[h265ize]: [debug] Running Query: ffmpeg -i GH010122_1566977284213_high.MP4 -y -acodec copy -vcodec libx265 -c:s copy -pix_fmt yuv420p -map 0:0 -map 0:1 -map 0:2 -map 0:3 -preset fast -x265-params crf=19: C:\Users\WarumM\AppData\Local\Temp\h265ize\GH010122_1566977284213_high.encoding-in-progress.mkv
[h265ize]: [debug] Error: ffmpeg exited with code 1: Press [q] to stop, [?] for help
Too many packets buffered for output stream 0:3.
Conversion failed!

    at ChildProcess.<anonymous> (C:\Users\WarumM\AppData\Roaming\npm\node_module
s\h265ize\node_modules\fluent-ffmpeg\lib\processor.js:182:22)
    at ChildProcess.emit (events.js:200:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
[h265ize]: ffmpeg exited with code 1: Press [q] to stop, [?] for help
Too many packets buffered for output stream 0:3.
Conversion failed!

[h265ize]: [verbose] Finished encoding at Wed, 1:13 PM (a few seconds)
[h265ize]: [debug] Finished encoding in 21.292 seconds.
[h265ize]: Folder encoding finished at Wednesday, August 28th 2019, 1:13:39 PM
--------------------------------------------------------------------------------

[h265ize]: [alert] The following videos (1) were not encoded:
        - GH010122_1566977284213_high.MP4: ffmpeg exited with code 1: Press [q]
to stop, [?] for help
Too many packets buffered for output stream 0:3.
Conversion failed!

[h265ize]: Process exited.

For the sake of completeness, here is what ffprobe has to say about the source file:

C:\Users\WarumM\Desktop>ffprobe -hide_banner -show_streams GH010122_1566977284213_high.MP4
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000004834c0] Using non-standard frame rate 29/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GH010122_1566977284213_high.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2019-08-28T09:01:32.000000Z
    firmware        : HD7.01.01.70.00
  Duration: 00:02:36.72, start: 0.000000, bitrate: 60310 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 60036 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2019-08-28T09:01:32.000000Z
      handler_name    : GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 09:19:39:20
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2019-08-28T09:01:32.000000Z
      handler_name    : GoPro TCD
      timecode        : 09:19:39:20
    Stream #0:2(eng): Data: bin_data (gpmd / 0x646D7067), 230 kb/s (default)
    Metadata:
      creation_time   : 2019-08-28T09:01:32.000000Z
      handler_name    : GoPro MET
    Stream #0:3(eng): Data: none (fdsc / 0x63736466), 7 kb/s (default)
    Metadata:
      creation_time   : 2019-08-28T09:01:32.000000Z
      handler_name    : GoPro SOS
Unsupported codec with id 0 for input stream 1
Unsupported codec with id 100359 for input stream 2
Unsupported codec with id 0 for input stream 3
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1001/60000
codec_tag_string=avc1
codec_tag=0x31637661
width=3840
height=2160
coded_width=3840
coded_height=2160
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuvj420p
level=51
color_range=pc
color_space=bt709
color_transfer=bt709
color_primaries=bt709
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=30000/1001
avg_frame_rate=30000/1001
time_base=1/90000
start_pts=0
start_time=0.000000
duration_ts=14105091
duration=156.723233
bit_rate=60036758
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=4697
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2019-08-28T09:01:32.000000Z
TAG:language=eng
TAG:handler_name=♂GoPro AVC
TAG:encoder=GoPro AVC encoder
TAG:timecode=09:19:39:20
[/STREAM]
[STREAM]
index=1
codec_name=unknown
codec_long_name=unknown
profile=unknown
codec_type=data
codec_tag_string=tmcd
codec_tag=0x64636d74
id=N/A
r_frame_rate=0/0
avg_frame_rate=29/1
time_base=1/90000
start_pts=0
start_time=0.000000
duration_ts=14105091
duration=156.723233
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=1
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2019-08-28T09:01:32.000000Z
TAG:language=eng
TAG:handler_name=♂GoPro TCD
TAG:timecode=09:19:39:20
[/STREAM]
[STREAM]
index=2
codec_name=bin_data
codec_long_name=binary data
profile=unknown
codec_type=data
codec_tag_string=gpmd
codec_tag=0x646d7067
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/9000
start_pts=0
start_time=0.000000
duration_ts=1567098
duration=174.122000
bit_rate=230918
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=4706
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2019-08-28T09:01:32.000000Z
TAG:language=eng
TAG:handler_name=♂GoPro MET
[/STREAM]
[STREAM]
index=3
codec_name=unknown
codec_long_name=unknown
profile=unknown
codec_type=data
codec_tag_string=fdsc
codec_tag=0x63736466
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/90000
start_pts=0
start_time=0.000000
duration_ts=14105091
duration=156.723233
bit_rate=7716
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=9405
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2019-08-28T09:01:32.000000Z
TAG:language=eng
TAG:handler_name=♂GoPro SOS
[/STREAM]

However, I was able to work around this issue by first just running ffmpeg myself with a simple ffmpeg -i source.mp4 -c:v copy -an dest.mkv and then let h265ize work on that instead. (Since it was a timelapse, there was no audio stream.)

This is probably a weird edge case that might not even be h265ize's fault, stemming from either the mp4 container or the data streams that ffmpeg is not very pleased about. I personally assume it is the latter, but I have not done extensive trials. In that case, it might be worthwhile to add cli options to whitelist/blacklist certain streams?

@ddev687
Copy link

ddev687 commented Aug 12, 2020

Got the same issue fixed by setting -max_muxing_queue_size 1024 after file name
https://stackoverflow.com/a/50262835/7405525

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants