Answers.Body: <p>I had the same problem with such setup, i.e. input frames as PNGs + audio.</p>
  <p>My workaround for silencing the warning was <code>-thread_queue_size</code> parameter with max possible value (i.e. bigger than my total amount of PNG frames) before each input.</p>
  <p>Considering you have a video clip with duration ~3:30, I would try the command:</p>
  <pre><code>ffmpeg.exe -f image2 -framerate ntsc -thread_queue_size 5040 -i %%06d.png \
  -thread_queue_size 5040 -i D:\encode\original.avi \
  -map 0:v:0 -map 1:a:0 -acodec copy -c:v libx265 -crf 28 -preset medium \
  -pix_fmt yuv420p -r ntsc D:\encode\new.mkv
  </code></pre>
  <p>If the message really impacts the output quality, sorry can not confirm. For me was quicker just to set the limit.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-15T16:53:18.473Z
Answers.LastActivityDate: 2021-03-16T12:05:48.280Z
Answers.LastEditDate: 2021-03-16T12:05:48.280Z
Answers.UserDisplayName: inju
Body: <p>Hope someone can help me. I'm using ffmpeg to extract the frames from an old video as images, batch enhancing and upscaling the images, then renecoding the images together with the original audio to a new video. This does work and the result looks and sounds correct, but I get this error/warning during the process</p>
  <p><code>[image2 @ 0000022193c2e8c0] Thread message queue blocking; consider raising the thread_queue_size option</code></p>
  <p>Since the output seems correct, I don't know if I need to worry about this or not. Does this message imply frames were dropped? Or is it just telling me I can read faster than I can write?</p>
  <p>Everything I find about this online is from people doing real time encoding while streaming. I can understand a CPU may not keep up in that situation and drop some frames, but I'm encoding from files on disk to another file on disk. I would assume in this situation the program will just block the input threads till the output catches up, instead of dropping frames, but I'm not sure, which is why I ask here.</p>
  <p>This only happens if I include audio copy in the same command. I'm copying from the same original video I made the frames from (which was encoded at 29.97 fps). I am outputting to a video of the same framerate (I think). Is there something I'm doing wrong here?</p>
  <p><code>&gt; ffmpeg.exe -f image2 -framerate ntsc -i %%06d.png -i D:\encode\original.avi -map 0:v:0 -map 1:a:0 -acodec copy -c:v libx265 -crf 28 -preset medium -pix_fmt yuv420p -r ntsc D:\encode\new.mkv</code></p>
  <pre><code>ffmpeg version 4.3.1-2020-11-19-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
    built with gcc 10.2.0 (Rev5, Built by MSYS2 project)
    configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
    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
    libswscale      5.  7.100 /  5.  7.100
    libswresample   3.  7.100 /  3.  7.100
    libpostproc    55.  7.100 / 55.  7.100
  Input #0, image2, from '%06d.png':
    Duration: 00:03:29.84, start: 0.000000, bitrate: N/A
      Stream #0:0: Video: png, rgb24(pc), 1280x720, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
  Guessed Channel Layout for Input Stream #1.1 : stereo
  Input #1, avi, from 'D:\encode\original.avi':
    Duration: 00:03:29.84, start: 0.000000, bitrate: 2202 kb/s
      Stream #1:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 352x240 [SAR 1:1 DAR 22:15], 778 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 30k tbc
      Stream #1:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (png (native) -&gt; hevc (libx265))
    Stream #1:1 -&gt; #0:1 (copy)
  Press [q] to stop, [?] for help
  x265 [info]: HEVC encoder version 3.4+27-g5163c32d7
  x265 [info]: build info [Windows][GCC 10.2.0][64 bit] 8bit+10bit+12bit
  x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
  x265 [info]: Main profile, Level-3.1 (Main tier)
  x265 [info]: Thread pool created using 24 threads
  x265 [info]: Slices                              : 1
  x265 [info]: frame threads / pool features       : 4 / wpp(12 rows)
  x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
  x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
  x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
  x265 [info]: Keyframe min / max / scenecut / bias  : 25 / 250 / 40 / 5.00
  x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
  x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
  x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
  x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
  x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
  x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
  x265 [info]: tools: b-intra strong-intra-smoothing lslices=4 deblock sao
  Output #0, matroska, to 'D:\encode\new.mkv':
    Metadata:
      encoder         : Lavf58.45.100
      Stream #0:0: Video: hevc (libx265), yuv420p, 1280x720, q=-1--1, 29.97 fps, 1k tbn, 29.97 tbc
      Metadata:
        encoder         : Lavc58.91.100 libx265
      Side data:
        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
      Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
  [image2 @ 0000022193c2e8c0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
  frame= 6289 fps= 88 q=35.9 Lsize=   59028kB time=00:03:29.84 bitrate=2304.4kbits/s speed=2.92x
  video:22746kB audio:36149kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.226772%
  x265 [info]: frame I:     34, Avg QP:28.64  kb/s: 2940.00
  x265 [info]: frame P:   1520, Avg QP:30.35  kb/s: 1771.54
  x265 [info]: frame B:   4735, Avg QP:33.71  kb/s: 588.33
  x265 [info]: Weighted P-Frames: Y:3.4% UV:2.5%
  x265 [info]: consecutive B-frames: 1.5% 0.6% 6.1% 75.2% 16.5%
   
  encoded 6289 frames in 71.77s (87.63 fps), 887.02 kb/s, Avg QP:32.87
  </code></pre>
  
Tags: <ffmpeg><encoding>
Title: ffmpeg showing "Thread message queue blocking" error while encoding (non real time)
UserDisplayName: Falconne
ThreadText: # ffmpeg showing "Thread message queue blocking" error while encoding (non real time)
  
  (Asked by: username_0 on 2020-12-28)
  
  Hope someone can help me. I'm using ffmpeg to extract the frames from an old video as images, batch enhancing and upscaling the images, then renecoding the images together with the original audio to a new video. This does work and the result looks and sounds correct, but I get this error/warning during the process
  
  `[image2 @ 0000022193c2e8c0] Thread message queue blocking; consider raising the thread_queue_size option`
  
  Since the output seems correct, I don't know if I need to worry about this or not. Does this message imply frames were dropped? Or is it just telling me I can read faster than I can write?
  
  Everything I find about this online is from people doing real time encoding while streaming. I can understand a CPU may not keep up in that situation and drop some frames, but I'm encoding from files on disk to another file on disk. I would assume in this situation the program will just block the input threads till the output catches up, instead of dropping frames, but I'm not sure, which is why I ask here.
  
  This only happens if I include audio copy in the same command. I'm copying from the same original video I made the frames from (which was encoded at 29.97 fps). I am outputting to a video of the same framerate (I think). Is there something I'm doing wrong here?
  
  `> ffmpeg.exe -f image2 -framerate ntsc -i %%06d.png -i D:\encode\original.avi -map 0:v:0 -map 1:a:0 -acodec copy -c:v libx265 -crf 28 -preset medium -pix_fmt yuv420p -r ntsc D:\encode\new.mkv`
  
  ```
  ffmpeg version 4.3.1-2020-11-19-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
    built with gcc 10.2.0 (Rev5, Built by MSYS2 project)
    configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
    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
    libswscale      5.  7.100 /  5.  7.100
    libswresample   3.  7.100 /  3.  7.100
    libpostproc    55.  7.100 / 55.  7.100
  Input #0, image2, from '%06d.png':
    Duration: 00:03:29.84, start: 0.000000, bitrate: N/A
      Stream #0:0: Video: png, rgb24(pc), 1280x720, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
  Guessed Channel Layout for Input Stream #1.1 : stereo
  Input #1, avi, from 'D:\encode\original.avi':
    Duration: 00:03:29.84, start: 0.000000, bitrate: 2202 kb/s
      Stream #1:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 352x240 [SAR 1:1 DAR 22:15], 778 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 30k tbc
      Stream #1:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
  Stream mapping:
    Stream #0:0 -> #0:0 (png (native) -> hevc (libx265))
    Stream #1:1 -> #0:1 (copy)
  Press [q] to stop, [?] for help
  x265 [info]: HEVC encoder version 3.4+27-g5163c32d7
  x265 [info]: build info [Windows][GCC 10.2.0][64 bit] 8bit+10bit+12bit
  x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
  x265 [info]: Main profile, Level-3.1 (Main tier)
  x265 [info]: Thread pool created using 24 threads
  x265 [info]: Slices                              : 1
  x265 [info]: frame threads / pool features       : 4 / wpp(12 rows)
  x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
  x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
  x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
  x265 [info]: Keyframe min / max / scenecut / bias  : 25 / 250 / 40 / 5.00
  x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
  x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
  x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
  x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
  x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
  x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
  x265 [info]: tools: b-intra strong-intra-smoothing lslices=4 deblock sao
  Output #0, matroska, to 'D:\encode\new.mkv':
    Metadata:
      encoder         : Lavf58.45.100
      Stream #0:0: Video: hevc (libx265), yuv420p, 1280x720, q=-1--1, 29.97 fps, 1k tbn, 29.97 tbc
      Metadata:
        encoder         : Lavc58.91.100 libx265
      Side data:
        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
      Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
  [image2 @ 0000022193c2e8c0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
  frame= 6289 fps= 88 q=35.9 Lsize=   59028kB time=00:03:29.84 bitrate=2304.4kbits/s speed=2.92x
  video:22746kB audio:36149kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.226772%
  x265 [info]: frame I:     34, Avg QP:28.64  kb/s: 2940.00
  x265 [info]: frame P:   1520, Avg QP:30.35  kb/s: 1771.54
  x265 [info]: frame B:   4735, Avg QP:33.71  kb/s: 588.33
  x265 [info]: Weighted P-Frames: Y:3.4% UV:2.5%
  x265 [info]: consecutive B-frames: 1.5% 0.6% 6.1% 75.2% 16.5%
   
  encoded 6289 frames in 71.77s (87.63 fps), 887.02 kb/s, Avg QP:32.87
  
  ```
  
  **Tags:** ffmpeg, encoding
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-03-15. Score: 0
  
  I had the same problem with such setup, i.e. input frames as PNGs + audio.
  
  My workaround for silencing the warning was `-thread_queue_size` parameter with max possible value (i.e. bigger than my total amount of PNG frames) before each input.
  
  Considering you have a video clip with duration ~3:30, I would try the command:
  
  ```
  ffmpeg.exe -f image2 -framerate ntsc -thread_queue_size 5040 -i %%06d.png \
  -thread_queue_size 5040 -i D:\encode\original.avi \
  -map 0:v:0 -map 1:a:0 -acodec copy -c:v libx265 -crf 28 -preset medium \
  -pix_fmt yuv420p -r ntsc D:\encode\new.mkv
  
  ```
  
  If the message really impacts the output quality, sorry can not confirm. For me was quicker just to set the limit.
  
  
  ---
  
  