Opened 7 years ago

Closed 7 years ago

#7120 closed defect (fixed)

Intel QSV: "QSV requires a fixed frame pool size" message is given on encoder initialization failure

Reported by: Dennis E. Mungai Owned by:
Priority: minor Component: avcodec
Version: unspecified Keywords: qsv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Initializing the h264_qsv encoder halts with the error above.

How to reproduce:

Using a sample from the Jellyfish UHD clip collection, I ran FFmpeg as shown:

ffmpeg -stream_loop -1 -loglevel debug -threads 4 -init_hw_device qsv=qsv:MFX_IMPL_hw_any -hwaccel qsv -filter_hw_device qsv -i ~/samples/jellyfish-40-mbps-hd-h264.mkv -vf 'format=nv12,hwupload,scale_qsv=1920:1080' -b:v 1000k -c:v h264_qsv -rdo 1 -pic_timing_sei 1 -recovery_point_sei 1 -profile:v high -aud 1 -f matroska -y ~/test_output/hammer.mkv

Output:

Platform information:

  1. FFmpeg version:
ffmpeg -version
ffmpeg version N-90590-g197a4e8fee Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
configuration: --pkg-config-flags=--static --prefix=/home/bob/bin --bindir=/home/bob/bin --extra-cflags=-I/home/bob/bin/include --extra-ldflags=-L/home/bob/bin/lib --extra-cflags=-I/opt/intel/mediasdk/include --extra-ldflags=-L/opt/intel/mediasdk/lib --extra-ldflags=-L/opt/intel/mediasdk/plugins --enable-libmfx --enable-vaapi --disable-debug --enable-libvorbis --enable-libvpx --enable-libdrm --enable-gpl --cpu=native --enable-libfdk-aac --enable-libx264 --enable-libx265 --extra-libs=-lpthread --enable-nonfree
libavutil      56. 12.100 / 56. 12.100
libavcodec     58. 17.100 / 58. 17.100
libavformat    58. 10.100 / 58. 10.100
libavdevice    58.  2.100 / 58.  2.100
libavfilter     7. 14.100 /  7. 14.100
libswscale      5.  0.102 /  5.  0.102
libswresample   3.  0.101 /  3.  0.101
libpostproc    55.  0.100 / 55.  0.100
  1. FFmpeg build configuration:
  configuration:
    --pkg-config-flags=--static
    --prefix=/home/bob/bin
    --bindir=/home/bob/bin
    --extra-cflags=-I/home/bob/bin/include
    --extra-ldflags=-L/home/bob/bin/lib
    --extra-cflags=-I/opt/intel/mediasdk/include
    --extra-ldflags=-L/opt/intel/mediasdk/lib
    --extra-ldflags=-L/opt/intel/mediasdk/plugins
    --enable-libmfx
    --enable-vaapi
    --disable-debug
    --enable-libvorbis
    --enable-libvpx
    --enable-libdrm
    --enable-gpl
    --cpu=native
    --enable-libfdk-aac
    --enable-libx264
    --enable-libx265
    --extra-libs=-lpthread
    --enable-nonfree

Change History (6)

comment:1 by Dennis E. Mungai, 7 years ago

Error log:

[AVHWFramesContext @ 0x3e26ec0] QSV requires a fixed frame pool size
[AVHWFramesContext @ 0x3e26ec0] Error creating an internal frame pool
[Parsed_hwupload_1 @ 0x3e26880] Failed to configure output pad on Parsed_hwupload_1
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
[AVIOContext @ 0x3a68f80] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0x3a6cd40] Statistics: 1022463 bytes read, 0 seeks
Conversion failed!

comment:2 by jkqxz, 7 years ago

Use -extra_hw_frames to set an initial pool size.

There are ideas about making this happen automatically, but the problem is that we don't have enough negotiation between components to know how big the pool should be - if it's feeding into a scaler then probably 2 or 3 frames are sufficient, but if it's feeding into an encoder with lookahead enabled then you might need over 100. As such, it's currently under user control.

comment:3 by Dennis E. Mungai, 7 years ago

Alright, thanks.

Should that option (-extra_hw_frames) be passed as an option to FFmpeg directly, or as an argument to the encoder (h264_qsv), or as a video filter argument?

comment:4 by jkqxz, 7 years ago

In this case you want it as a filter argument to hwupload: hwupload=extra_hw_frames=1234 (replace with suitable value, probably something like 10 works for you here).

comment:5 by Dennis E. Mungai, 7 years ago

Thank you so much, it works! Closing the ticket.

comment:6 by Dennis E. Mungai, 7 years ago

Priority: normalminor
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.