Media (Intel® oneAPI Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools from Intel. This includes Intel® oneAPI Video Processing Library and Intel® Media SDK.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Intermittent device failures when encoding with h264_qsv


I'm experimenting with using the h264_qsv encoder and am experiencing "device failure (-17)" issues under varying workloads.

Product version: sample_encode.exe from Media Server 2017 R3 and ffmpeg (built from master)
Platform: Core i7 4712HQ @ 2.30GHz, Intel HD 4600 (driver version, Windows 10 (also has an NVidia Quadro K1100M)

Problem description:
When running the sample_encode from the SDK everything works properly.  I can encode 720p up to 1440p with no problems whatsoever - I have yet to run into any issues when using the Intel provided sample_encode.  However, when encoding using the latest version of ffmpeg on any file with resolution greater than 720p I quite often (20 to 90% of the time) receive the following error either immediately after encoding starts or within the first few seconds after encoding starts: Error during encoding: device failed (-17). How often it fails and reports this error appears to be related to the resolution - the higher the resolution the more often the failure will appear and encoding will fail.

Test files:

Test scenario decoding a file and then encoding into an 1440p h264 file using ffmpeg:
1) Convert any of the above mp4 files into a yuv using ffmpeg:
ffmpeg -i 13586.mp4 -vf scale=2560:1440 13586_1440p.yuv
2) Encode the yuv file using h264_qsv:
ffmpeg -s 2560x1440 -i 13586_1440p.yuv -c:v h264_qsv -y 13586_1440p.h264

Using the system stated above the 2) command will fail about 80% of the time.  I've also been able to reproduce the same exact scenario and failure using a Core i7-6700 @ 3.4GHz with Intel HD Graphics 530 (driver version, Windows 2012 R2 (also has an NVidia GeForce GTX 970).

Tracer logs for the above test scenario can be found here (also includes sample_encode logs as well for comparison):
The sample_encode logs show that the MFXVideoENCODE_EncodeFrameAsync() call typically results in status = MFX_ERR_NONE, however ffmpeg's calls report status = MFX_WRN_DEVICE_BUSY.  Is this significant?  I tried adjusting ffmpeg's av_usleep() value in encode_frame() in qsvenc.c with no success.

Oddly enough, using ffmpeg with the hevc_qsv encoder will not report the "device failed (-17)" error, however it will stall out either immediately or within the first few seconds of encoding (similar to the failure point when encoding using h264_qsv).
Sample hevc command line:
ffmpeg -s 2560x1440 -i -i 13586_1440p.yuv -c:v hevc_qsv -load_plugin hevc_hw -q 30 -y 13586_1440p_hevc.h265

Is this an ffmpeg issue or a driver issue?  I can provide more information, please let me know.  Thank you.


0 Kudos
0 Replies