[FFmpeg-trac] #7330(avcodec:new): ffmpeg 4.0 fails to transcoding one 4k clip
FFmpeg
trac at avcodec.org
Thu Aug 23 12:14:26 EEST 2018
#7330: ffmpeg 4.0 fails to transcoding one 4k clip
------------------------------------+-----------------------------------
Reporter: applemax82 | Owner:
Type: defect | Status: new
Priority: normal | Component: avcodec
Version: git-master | Resolution:
Keywords: qsv | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
------------------------------------+-----------------------------------
Comment (by fulinjie):
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:
1. src_AVC_4K.mp4 has some errors: Value of slice::pic_parameter_set_id is
out of range.
2. it can be decoded successfully in soft ways but fails in h264_qsv.
3. 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.
4. 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.
5. 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.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7330#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list