Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

FFMPEG freeze when QSV encoding used

Ramakrishna_A_
Beginner
771 Views

 

FFMPEG randomly freezes if QSV is used for 1920x1080p encoding, it works fine for 720p. If I run the same command in 10 iterations or so, it freezes at particular iteration. Sometimes it may freeze at first iteration.

At the point of freeze, the value of  "sync" LSB value kept on increasing, for example 0x1001, 0x1402  , and 0x1803  . It seems the MSB increment is expected. Does anyone help to interpret these values?

MFXVideoENCODE_EncodeFrameAsync(q->session, NULL, surf, bs, &sync);

 

 

0 Kudos
3 Replies
Harshdeep_B_Intel
771 Views

Hi Ramakrishna, 

So, we can isolate the issue to FFMPEG vs QSV (MediaSDK HW acceleration). Can you install and run sample_encode (https://software.intel.com/sites/default/files/managed/b7/7e/MediaSamples_Windows_2016.msi) and let us know if you observe similar behavior. Let me know your findings?

Thanks,

 

0 Kudos
Ramakrishna_A_
Beginner
771 Views

Hi Harsh,

I did run sample_encode and observe no issues in that. I have been trying, for almost a week, to find the cause for random freeze behavior in ffmpeg. But, no luck so far. What I posted earlier is the only clue that I got.

Below is the critical part of the code, in ffmpeg, which is causing random freeze,

    do {
        ret = MFXVideoENCODE_EncodeFrameAsync(q->session, enc_ctrl, surf, bs, &sync);
        if (ret == MFX_WRN_DEVICE_BUSY) {
            av_usleep(500);
            continue;
        }
        break;
    } while ( 1 );

The return status of "MFXVideoENCODE_EncodeFrameAsync(q->session, NULL, surf, bs, &sync);" is "busy" indefinitely at the time of freeze. As the return status is "busy" always, the loop is not hitting the break condition.

Just to give you more background, I have matched the input parameters between Intel SDK's "sample_encode" and ffmpeg. Also, output is from both applications is almost matching, except for SEI meta data. SEI data doesn't look to be causing the issue.

There is one similar issue filed in ffmpeg bug tracker. https://trac.ffmpeg.org/ticket/4832

0 Kudos
Harshdeep_B_Intel
771 Views

Hi Ramakrishna, 

Thank you for testing and sharing your findings. As, sample_encode works with out any issue, we can confirm no issue with QSV (HW acceleration). FFMPEG is a open source software and integration of msdk to ffmpeg is completely handled by the ffmpeg community, here issue could be in msdk integration to ffmpeg.  I suggest directing this issue (https://ffmpeg.org/bugreports.html) and posting on ffmpeg forum. In meantime, I will escalate this issue internally to ffmpeg too.  

Thanks,

 

0 Kudos
Reply