#7330 closed defect (invalid)
ffmpeg 4.0 fails to transcoding one 4k clip
Reported by: | applemax82 | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | qsv |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
How to reproduce:
% ffmpeg -nostdin -y -hwaccel qsv -c:v h264_qsv -i src_AVC_4K.mp4 -b:a 80000 -ar 44100 -c:v h264_qsv -g 300 -profile:v high -preset veryfast -c:a libfdk_aac -max_muxing_queue_size 4000 -b:v 17418000 -movflags +faststart -strict -3 -vsync passthrough -f mp4 dst_AVC_4K.mp4 ffmpeg 4.0.2 + 4.0 ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-16) configuration: --enable-version3 --enable-asm --enable-x86asm --enable-avfilter --disable-static --enable-shared --enable-gpl --enable-nonfree --prefix=/usr/local/ --enable-libvidstab --enable-libass --enable-libfreetype --extra-libs=-lfreetype --enable-libtesseract --enable-libfdk_aac --enable-libmp3lame --enable-libx264 --enable-libopenjpeg --enable-libwebp --enable-libx265 --enable-libvorbis --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --enable-stripping --enable-libmfx libavutil 56. 14.100 / 56. 14.100 libavcodec 58. 18.100 / 58. 18.100 libavformat 58. 12.100 / 58. 12.100 libavdevice 58. 3.100 / 58. 3.100 libavfilter 7. 16.100 / 7. 16.100 libswscale 5. 1.100 / 5. 1.100 libswresample 3. 1.100 / 3. 1.100 libpostproc 55. 1.100 / 55. 1.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'src_AVC_4K.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.12.100 Duration: 00:00:03.05, start: 0.000000, bitrate: 42590 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 3840x2160 [SAR 1:1 DAR 16:9], 43119 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 82 kb/s (default) Metadata: handler_name : SoundHandler Stream mapping: Stream #0:0 -> #0:0 (h264 (h264_qsv) -> h264 (h264_qsv)) Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac)) [h264_qsv @ 0x22b8480] Encoder will work with partial HW accelerationte= -0.0kbits/s speed=N/A [h264_qsv @ 0x22b8480] Error initializing the encoder: invalid video parameters (-15) Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height [libfdk_aac @ 0x23b12c0] 2 frames left in the queue on closing Conversion failed! src_AVC_4K.mp4 can be downloaded via the link url: https://drive.google.com/file/d/15X7RYIEEvInN8y1gqrZax3-ZGjpcJQ_C/view?usp=sharing Is it a ffmpeg bug?
Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.
Change History (10)
comment:1 by , 6 years ago
Keywords: | Intel removed |
---|
comment:2 by , 6 years ago
Reproduced on the latest ffmpeg master version.
ffmpeg -nostdin -y -hwaccel qsv -c:v h264_qsv -i src_AVC_4K.mp4 -b:a 80000 -ar 44100 -c:v h264_qsv -g 300 -profile:v high -preset veryfast -c:a libfdk_aac -max_muxing_queue_size 4000 -b:v 17418000 -movflags +faststart -strict -3 -vsync passthrough -f mp4 dst_AVC_4K.mp4
Failed with:
[h264_qsv @ 0x55997bc94d80] Current profile is unsupported [h264_qsv @ 0x55997bc94d80] Selected ratecontrol mode is unsupported [h264_qsv @ 0x55997bc94d80] Current frame rate is unsupported [h264_qsv @ 0x55997bc94d80] Current picture structure is unsupported [h264_qsv @ 0x55997bc94d80] Current resolution is unsupported [h264_qsv @ 0x55997bc94d80] Current pixel format is unsupported [h264_qsv @ 0x55997bc94d80] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters. [h264_qsv @ 0x55997bc94d80] encoded 0 frames, avarge qp is -nan Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Encoder initializing failed.
Frame can not be decoded but no errors reported.
Tracing this issue:
- src_AVC_4K.mp4 has some errors: Value of slice::pic_parameter_set_id is out of range.
- it can be decoded successfully in soft ways but fails in h264_qsv.
- in the function of decode_simple_receive_frame():
while (!frame->buf[0]) { ret = decode_simple_internal(avctx, frame); if (ret < 0) return ret; }
When decode_simple_internal returns a normal value (ret = 0), the value of frame->buf[0] still equals to 0x00 which is incorrect. So it can not jump out of the loop until decode_simple_internal returns -11 (wait for data to be processed).
It's the reason why frames can't be decoded but report no errors.
- The function qsv_decode() in qsvdec.c calls :
ret = MFXVideoDECODE_DecodeFrameAsync(q->session, avpkt->size ? &bs : NULL, insurf, &outsurf, sync);
returns: ret = -10, whcih means MFX_ERR_MORE_DATA (/* expect more data at input */ according to the mfxdefs.h)
This lead to the error condition in 4.
- Varify this issue through MSDK sample_decode:
./sample_decode h264 -i src_AVC_4K.mp4 -o sample_out.mp4 [ERROR], sts=MFX_ERR_MORE_DATA(-10), InitMfxParams, m_FileReader->ReadNextFrame failed at /home/linjiefu/Documents/git/msdk/samples/sample_decode/src/pipeline_decode.cpp:653 [ERROR], sts=MFX_ERR_MORE_DATA(-10), Init, InitMfxParams failed at /home/linjiefu/Documents/git/msdk/samples/sample_decode/src/pipeline_decode.cpp:395 [ERROR], sts=MFX_ERR_MORE_DATA(-10), main, Pipeline.Init failed at /home/linjiefu/Documents/git/msdk/samples/sample_decode/src/sample_decode.cpp:666
sample_decode can't decode src_AVC_4K.mp4 successfully.
comment:3 by , 6 years ago
Though the error message remind some thing wrong in qsv encoder, actually it is an decoding issue: can't get the decoded frame successfully and then avctx->hw_frames_ctx is NULL in qsvenc_init_session, thus cause encoder device hasn't been initialized successfully.
comment:4 by , 6 years ago
As an option, can use vaapi decoder + qsv encoder: ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i src_AVC_4K.mp4.mp4 -vf 'hwmap=derive_device=qsv,format=qsv' -c:v h264_qsv -b:v 5M output.mp4
comment:6 by , 5 years ago
Replying to cehoyos:
Where can the sample be found?
It was put on google doc as the bug description:https://drive.google.com/file/d/15X7RYIEEvInN8y1gqrZax3-ZGjpcJQ_C/view?usp=sharing
comment:7 by , 5 years ago
This clip is H264 6.0 level. However, The maximum level supported by MSDK is 5.2.
There are some limitation on Intel HW platform (e.g: Skylake) to support level 6.0+: Resolution larger than 4K is not supported, and there are some other limitation such MV range(such is MB level limitation which is are hard to check in MSDK and vaapi driver).
I wonder to know the possibility to exposing level 6.0+ in MSDK (at least in API level, just like VAAPI is doing. Relative discussion: https://github.com/intel/intel-vaapi-driver/issues/307). But anyway, I believe this is not a ffmpeg issue and should be closed here.
comment:8 by , 5 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:9 by , 5 years ago
Resolution: | wontfix → invalid |
---|
comment:10 by , 5 years ago
commit_id 48627aaf646270a8c98337ee208574543e499bfd is helpful to detect HW limitation and give an warning message.
Please test current FFmpeg git head to make this a valid ticket and please post gpu and driver information.