Intel-Media-SDK / MediaSDK

The Intel® Media SDK
MIT License
935 stars 460 forks source link

Encoder fails #1663

Open MonkeySon opened 5 years ago

MonkeySon commented 5 years ago

Hi,

currently I am on an Ubuntu Server 19.04 machine with the J4105 Gemini Lake CPU. I followed the wiki guides to get the Media SDK working with ffmpeg:

https://github.com/Intel-Media-SDK/MediaSDK/wiki/Intel-media-stack-on-Ubuntu https://github.com/Intel-Media-SDK/MediaSDK/wiki/Build-and-use-ffmpeg-with-MediaSDK

I got all libraries/drivers from the repository and built ffmpeg with the necessary configuration flags.

The decoding examples run well but encoding fails:

MFX sample_encode:

GPU hang happened

[ERROR], sts=MFX_ERR_GPU_HANG(-21), Run, m_pmfxENC->EncodeFrameAsync failed at /build/intel-mediasdk-AzMSof/intel-mediasdk-18.4.1/samples/sample_encode/src/pipeline_encode.cpp:2085

[ERROR], sts=MFX_ERR_GPU_HANG(-21), main, pPipeline->Run failed at /build/intel-mediasdk-AzMSof/intel-mediasdk-18.4.1/samples/sample_encode/src/sample_encode.cpp:1364 Frame number: 2

ffmpeg ecoding/transcodig:

[hevc_qsv @ 0x55a354f29340] Unknown FrameType, set pict_type to AV_PICTURE_TYPE_NONE.

[hevc @ 0x55a354fa5f80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 3 >= 0

[hevc_qsv @ 0x55a354f29340] Error during encoding: unknown error (-21)

Video encoding failed

Is this a problem with an old version? According to apt, I am currently using:

Package: libmfx1 Version: 18.4.1-0ubuntu1

dmitryermilov commented 5 years ago

Hi @MonkeySon , what Linux kernel do you use?

dmitryermilov commented 5 years ago

Since GPU hang is seen using both MediaSDK and ffmpeg, it's user mode driver issue. Can you please submit an issue against https://github.com/intel/media-driver/ ?

MonkeySon commented 5 years ago

Hi @dmitryermilov

I got the following kernel:

uname -a
Linux ... 5.0.0-29-generic #31-Ubuntu SMP Thu Sep 12 13:05:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Okay, thanks, I will submit the issue there!

dvrogozh commented 4 years ago

As discussed in https://github.com/intel/media-driver/issues/733, mediasdk missed GLK device ID executing incorrect code path. We fixed that now (PR #1770 merged), but unfortunately there is another issue somewhere else, likely in a driver. We still working on it.

eero-t commented 4 years ago

While there's some GLK issue with media-driver, there's some issue also on MediaSDK side. Currently all the FFmpeg VA-API command lines supported by the HW run successfully to the end, while all the FFmpeg QSV command lines fail, on GLK J4005 (0x3185).

onabiull commented 2 years ago

Is this issue still actual given https://github.com/intel/media-driver/issues/930?

eero-t commented 2 years ago

Looking at some of my historical data, QSV transcoding started to return results for H.264 encoding about 1.5 years ago, and results for encodes both to 10-bit H.265 & 8-bit H.264 about 1 year ago on GLK. (VA-API never had an issue[1])

If the original bug reporter (from 2019) doesn't reply in week or two, I think you can close this.


[1] Earlier there were quite a lot of kernel stability issues both on GLK & BXT with large number of parallel transcodes, but those have been fixed long time ago too (except for https://gitlab.freedesktop.org/drm/intel/-/issues/3519 closed only 1/2 year ago).

Only remaining serious issue I had was when doing lot of parallel transcodes when VT-d is enabled, but I haven't tested that for few months: https://gitlab.freedesktop.org/drm/intel/-/issues/4082

(Somehow GFX IOMMU seemed to cause extra issues, which is a problem because VT-d has been enabled by default in BIOS on all machines I've seen.)