intel / media-driver

Intel Graphics Media Driver to support hardware decode, encode and video processing.
https://github.com/intel/media-driver/wiki
Other
1k stars 347 forks source link

[Issue] KO hardware decode/encode with Gemini lake family #930

Closed Jqh63 closed 3 years ago

Jqh63 commented 4 years ago

Desc: Hardware media decode/encode is KO with iHD driver on Gemini lake family

Unable to perform media decode/encode with iHD_drv_video.so, always have to force use of i965 driver. Impacts are degraded performance and capabilites: no HEVC 10bits for example or high CPU usage. Plus manual configuration is needed, like removal of iHD_drv_video.so or set up LIBVA_DRIVER_NAME to i965

Current behavior

iHD_drv_video.so generate error message or hangs on Gemini lake processors

Expected behavior

Working hardware decode as mention into VAAPI and Intel spec for GLK (especially HEVC 10bits HW encode)

How to reproduce

  1. run a Debian/Ubuntu/Alpine (docker or direct host)
  2. install intel-media-driver package to get a working VAAPI
  3. run a HW encode (plex, handbrake, ...), simple way is a handbrake test with H.265 Intel QSV (docker compose below)
  4. CPU/GPU hangs, artifacts into generated files, error messages..
    [16:42:39] hb_display_init: using VA driver 'iHD'
    libva info: VA-API version 1.7.0
    libva info: User environment variable requested driver 'iHD'
    libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so
    libva info: Found init function __vaDriverInit_1_7
    libva info: va_openDriver() returns 0
    [16:42:40] qsv_hevc_make_header: MFXVideoCORE_SyncOperation failed (-17)
    [16:42:40] encqsvInit: qsv_hevc_make_header failed
    [16:42:40] Failure to initialise thread 'Quick Sync Video encoder (Intel Media SDK)'

Ecosystem

On my test case:

Compose

version: '2.1'
services:
  handbrake:
    image: jlesage/handbrake
    container_name: handbrake
    environment:
      - USER_ID=1000
      - GROUP_ID=100
      - TZ=Europe/Paris
      #- LIBVA_DRIVER_NAME=i965
    ports:
      - 5800:5800
    volumes:
      - /srv/dev-disk-by-label-data/appdata/handbrake:/config:rw
      - /srv/dev-disk-by-label-media/media:/storage:ro
      - /srv/dev-disk-by-label-media/media/handbrake/watch:/watch:rw
      - /srv/dev-disk-by-label-media/media/handbrake/output:/output:rw
    devices:
      - /dev/dri:/dev/dri
    restart: unless-stopped

Refs

plex forum - tons of users issues plex docker image maybe related to issue 733

mrzippyuk commented 4 years ago

Any update on this, or additional info required as I also see the same issue here too.

Using Gigabyte Brix 4105C - so the J4105 processor.

Ubuntu 20.04.

libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.7 (libva 2.6.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.1.1 ()
Gorvaine commented 4 years ago

Same behavior here with another:

MB: Asrock J4105-ITX 90-Mxb6N0-A0Uayz CPU : Intel(R) Celeron(R) J4105

argakon commented 4 years ago

Same problem with:

MB: Asrock J4105-ITX

Artifacts in encoded video file.

THX723 commented 4 years ago

Adding issue to include all new 2020 Synology NAS based on J4105 and J4125 (GLK) CPU. Observing heavy artifact issue, especially with HEVC 8-bit.

XinfengZhang commented 4 years ago

1005 fixed basic function --- memory access of GLK. actually, because i965 and iHD both cover gen9 platforms, we suggest to switch driver from ICL.

Rimasi89 commented 4 years ago

Same issue even with the new updated plex apk (PlexMediaServer-1.19.5.3112)

NAS: Asustor 5202t CPU: Intel Celeron J4005

iHD.bak workaround was still needed :/

tlonic commented 4 years ago

Issue still present using bleeding edge packages:

kernel: 5.8.13-arch1-1 intel-gmmlib-git: 20.3.2.r0.g2072b0d-1 intel-media-driver-git: 2020.3.pre8.r94.g8de44c97-1 intel-media-sdk-git: 2020.3.pre6.r45.g7beb403e-1 CPU: Celeron J4115

Result of encoding video to HEVC 10-bit in Handbrake:

[13:45:23] hb_display_init: using VA driver 'iHD'
libva info: VA-API version 1.9.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_9
libva info: va_openDriver() returns 0
[13:45:23] encqsvInit: MFXVideoENCODE_Init failed (-17)
[13:45:23] Failure to initialise thread 'Quick Sync Video encoder (Intel Media SDK)'
Rimasi89 commented 4 years ago

I can conclude that this fix is not on the top priority list from both Plex and Intel. Nice one! 👏

alfureu commented 4 years ago

Well, more and more NASes are going to reach the market in the coming months with j4125 Celeron CPUs. The only way is to keep reminding Intel I guess...

My case is Asustor AS6604T unable to hardware transcode even into H264 (VAAPI), while much older processors were completely fine.

l1ge commented 4 years ago

I just got the new Synology DS1520+ which uses a J4125 Celeron, so i'd love a fix too for this driver!

davidsonb commented 4 years ago

Same problem. Plex and Synology DS1520+ which uses a J4125 Celeron.

jara1 commented 4 years ago

Same problem Qnap TS453D - Celeron J4125.

Rimasi89 commented 4 years ago

Same problem. Plex and Synology DS1520+ which uses a J4125 Celeron.

You should wait sitting............ They just don't even care. Since you pay every month they're happy...

alfureu commented 4 years ago

Shaming and naming ... they will care eventually :D

Rimasi89 commented 4 years ago

Shaming and naming ... they will care eventually :D

I wouldn't be so sure about that. With answers like this one bellow reflects how they care about they're customers and how about they care about the new one to come:

plex

👏👏👏

PLEX: "Every user has to decide for themselves whether they wish to continue a Plex Pass subscription. We can't make that decision for a user, of course."

👏👏👏

alfureu commented 4 years ago

Oh, I meant Intel and not Plex. I think the issue is with the driver and not with the Plex as an backend. I thought this is about Intel...

l1ge commented 4 years ago

yep i don't think Plex are the ones to blame now.

Xiaogangli-intel commented 4 years ago

Today, I checked #733, @XinfengZhang's PR #1005 should already fix this issue. I think these 2 issues should have the same root cause. Could you try the latest source and try again?

XinfengZhang commented 4 years ago
  1. have anyone tried #1005?? which already been merged. it should already fix most of GeminiLake issue. because this issue is mixed with MSDK issue https://github.com/Intel-Media-SDK/MediaSDK/issues/1663 , please also make sure msdk include https://github.com/Intel-Media-SDK/MediaSDK/pull/1770
  2. another problem is about application, as I know, https://github.com/intel/intel-vaapi-driver support GLK, to keep the support smooth, we recommend that users who are using i965 driver continue to use it on GLK. because the feature set maybe is different , for example: some VPP algorithm is different. of course, this case maybe is special? because Plex is using MSDK, MSDK works good with media_driver. but for most of usage. Application installation could choose different UMD on different platform. right?
l1ge commented 4 years ago

I would like to try if its solved with the latest source. But I have no idea how to replace the current driver version I have on my Synology DS1520+ by the new version that you fixed. I'm using plex for the transcode. Anyone has an idea?

tlonic commented 4 years ago

As seen in my comment above, at least HEVC 10-bit encoding is still broken using bleeding edge packages.

tlonic commented 4 years ago

HandBrakeCLI hangs at 0% when trying to use the QSV decoder with a HEVC 10-bit file, again, using bleeding edge packages:

kernel: 5.8.13-arch1-1 intel-gmmlib-git: 20.3.2.r0.g2072b0d-1 intel-media-driver-git: 2020.3.pre8.r94.g8de44c97-1 intel-media-sdk-git: 2020.3.pre6.r45.g7beb403e-1 CPU: Celeron J4115

x264 [info]: using SAR=1/1 x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 x264 [info]: profile High, level 4.0, 4:2:0, 8-bit Encoding: task 1 of 1, 0.00 %[13:04:21] sync: first pts audio 0x1 is 0 [hevc_qsv @ 0x7fc088037f00] Error initializing an MFX session [hevc_qsv @ 0x7fc088037f00] Error initializing the MFX video decoder: invalid handle (-6) [hevc_qsv @ 0x7fc088037f00] Error initializing an internal MFX session: unsupported (-3) ... Encoding: task 1 of 1, 0.00 %^CSignal 2 received, terminating - do it again in case it gets stuck Encoding: task 1 of 1, 0.00 %[13:06:32] work: average encoding speed for job is 0.000000 fps [13:06:32] aac-decoder done: 73073 frames, 0 decoder errors [13:06:32] hevc_qsv-decoder done: 0 frames, 37374 decoder errors [13:06:32] sync: got 0 frames, 120941 expected [13:06:32] mux: track 0, 0 frames, 0 bytes, 0.00 kbps, fifo 8 [13:06:32] mux: track 1, 72873 frames, 24288647 bytes, 124.99 kbps, fifo 131072 [13:06:32] Finished work at: Sat Oct 10 13:06:32 2020

HandBrake has exited.

QSV decoding of an H264 file also hangs:

[13:21:29] encx264: min-keyint: 30, keyint: 300 [13:21:29] encx264: encoding at constant RF 22.000000 x264 [info]: using SAR=1/1 x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 x264 [info]: profile High, level 4.0, 4:2:0, 8-bit Encoding: task 1 of 1, 0.00 %[13:21:29] sync: first pts audio 0x1 is 0 Encoding: task 1 of 1, 0.00 %[13:21:32] sync: reached audio 0x1 pts 2700000, exiting early [h264_qsv @ 0x7f2930033080] Error initializing an MFX session [h264_qsv @ 0x7f2930033080] Error initializing the MFX video decoder: invalid handle (-6) [h264_qsv @ 0x7f2930033080] Error initializing an internal MFX session: unsupported (-3) ... Encoding: task 1 of 1, 0.00 %^CSignal 2 received, terminating - do it again in case it gets stuck Encoding: task 1 of 1, 0.00 %[13:21:47] work: average encoding speed for job is 0.000000 fps [13:21:47] mp3float-decoder done: 7241 frames, 0 decoder errors [13:21:47] h264_qsv-decoder done: 0 frames, 5223 decoder errors [13:21:47] sync: got 0 frames, 930 expected [13:21:47] mux: track 0, 0 frames, 0 bytes, 0.00 kbps, fifo 8 [13:21:47] mux: track 1, 1405 frames, 483934 bytes, 129.19 kbps, fifo 2048 [13:21:47] Finished work at: Sat Oct 10 13:21:47 2020

HandBrake has exited.

QSV encoding of H264 and HEVC seems to work, however.

So in summary, QSV decoding does not work at all, and QSV encoding only works for H264 and non 10-bit HEVC.

XinfengZhang commented 4 years ago

I would like to try if its solved with the latest source. But I have no idea how to replace the current driver version I have on my Synology DS1520+ by the new version that you fixed. I'm using plex for the transcode. Anyone has an idea?

replace iHD package or redirect it by such env variables :LIBVA_DRIVERS_PATH=xxx

Xiaogangli-intel commented 4 years ago

@tlonic I checked with sample_decode, decode can work properly, you need to confirm whether your input stream is 10-bit HEVC. If yes, please provide your command line and stream. Thank you.

For HEVC 10-bit encode, I did find an issue on GLK, will fix it ASAP.

Jqh63 commented 3 years ago

@XinfengZhang Hello, any update about merge request? how can I test it anyway

Freeben666 commented 3 years ago

Any news on this ? I have an Asustor AS6604T NAS with a Celeron J4125 that is impacted.

k29t59dh commented 3 years ago

Has anyone successfully encoded 8-bit H.265 on Gemini Lake with this fix? 10 bit H.265 encode works on my j5005 but 8-bit fails with:

qsv_hevc_make_header: MFXVideoCORE_SyncOperation failed (-17)

XinfengZhang commented 3 years ago

the issue was closed automatically, because #1078 mentioned it fixed this issue. @Xiaogang-Li , we should already test 8 bit hevc encoding, it is strange , 10bit works ,but 8 bit failed. @k29t59dh , could you help to add more details?

k29t59dh commented 3 years ago

I'm getting the error in a HandBrake docker with driver version 20.4.4. What other details would be helpful - any commands I can run (and paste the output) or logs I should include?

jotacor commented 3 years ago

It happens the same to me with version 20.4.5. It encodes fine 10 bit x265 and x264, but not 8 bits. I'm working with an Intel j4125 processor.

Rimasi89 commented 3 years ago

I never got it fixed. I've disable the iHD intel driver!

I got an ASUSTOR NIMBUSTOR 2 with the intel J4005 and the issue was never fixed. I dont know why you closed the thread.

Obter o Outlook para Androidhttps://aka.ms/ghei36


From: jotacor notifications@github.com Sent: Wednesday, January 6, 2021 9:46:38 PM To: intel/media-driver media-driver@noreply.github.com Cc: Rimasi89 rimasi89@hotmail.com; Comment comment@noreply.github.com Subject: Re: [intel/media-driver] [Issue] KO hardware decode/encode with Gemini lake family (#930)

It happens the same to me with version 20.4.5. It encodes fine 10 bit x265 and x264, but not 8 bits. I'm working with an Intel j4125 processor.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/intel/media-driver/issues/930#issuecomment-755733384, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADBNDWLVEHIX7IWEYD6T3QDSYTK35ANCNFSM4M5IV5MA.

XinfengZhang commented 3 years ago

@Rimasi89 , have you tried the patch? if it was not fixed. let's reopen it, @Xiaogang-Li , could you help to double confirm whether it already been fixed?

jotacor commented 3 years ago

where/what is the patch?

Rimasi89 commented 3 years ago

I couldn't see the Patch like @jotacor

Obter o Outlook para Androidhttps://aka.ms/ghei36


From: jotacor notifications@github.com Sent: Thursday, January 7, 2021 6:19:14 PM To: intel/media-driver media-driver@noreply.github.com Cc: Rimasi89 rimasi89@hotmail.com; Mention mention@noreply.github.com Subject: Re: [intel/media-driver] [Issue] KO hardware decode/encode with Gemini lake family (#930)

where/what is the patch?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/intel/media-driver/issues/930#issuecomment-756290703, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADBNDWO7OPXA6DJ7BLFWKRLSYX3KFANCNFSM4M5IV5MA.

esmorun commented 3 years ago

I still can't do hardware transcoding in Jellyfin because of this issue. I'm on Ubuntu 20.04LTS and an Asrock j5005-board. Intel-media-va-driver-non-free (20.1.1+ds1-1build1).

If there is a patch, please let me know how I can test it and report back to you.

mkarwin commented 3 years ago

Has the issue been fixed on the NAS devices? Synology DSXX20+, Qnap TS-X53D, Asustor AS660XT and their rackmount counterparts are all affected it seems. Any owners care to verify that their platform's working fine already or to explicitly verify that the issue persists? The Gemini Lake Refresh CPUs are more or less ubiquituous amongst the NAS appliances from most NAS manufacturers that have been released within the last two years. It's almost 9 and a half months since the issue was first reported. Intel surely knows that these CPUs have been sold in large quantities to NAS manufacturers for home type appliances where transcoding/encoding/decoding features are of paramount importance since there is no easy way to replace said CPUs are gain additional peformance through add-in cards. As such, this should have already been fixed and verified with NAS manufacturers as parts of their respective OS updates.

DonCaliOni commented 3 years ago

Has the issue been fixed on the NAS devices? Synology DSXX20+, Qnap TS-X53D, Asustor AS660XT and their rackmount counterparts are all affected it seems. Any owners care to verify that their platform's working fine already or to explicitly verify that the issue persists? The Gemini Lake Refresh CPUs are more or less ubiquituous amongst the NAS appliances from most NAS manufacturers that have been released within the last two years. It's almost 9 and a half months since the issue was first reported. Intel surely knows that these CPUs have been sold in large quantities to NAS manufacturers for home type appliances where transcoding/encoding/decoding features are of paramount importance since there is no easy way to replace said CPUs are gain additional peformance through add-in cards. As such, this should have already been fixed and verified with NAS manufacturers as parts of their respective OS updates.

Hi, I have a QNAP TS-453D and I'm still having this damn issue! @mkarwin

DonCaliOni commented 3 years ago

Same problem Qnap TS453D - Celeron J4125.

Hi @jara1, did you ever get this sorted? I have the same NAS and still experiencing the issue...

alfureu commented 3 years ago

Here is a solution that works for Asustor (check YeJ's comment): https://emby.media/community/index.php?/topic/89948-hardware-encoding-issues-j4125/

Basically you have to delete/move the iHD_drv_video.so file from the libraries, and keep the i965_drv_video.so there. The hw with this driver seem to work.

jotacor commented 3 years ago

Here is a solution that works for Asustor (check YeJ's comment): https://emby.media/community/index.php?/topic/89948-hardware-encoding-issues-j4125/

Basically you have to delete/move the iHD_drv_video.so file from the libraries, and keep the i965_drv_video.so there. The hw with this driver seem to work.

That is a workaround, not a solution. A solution would be the developers fixing the issue affecting ALL Gemini Lake Intel processors.

alfureu commented 3 years ago

You are right, apologies for the bad wording, it is a workaround not a solution.

I would also welcome from @Xiaogang-Li (assigned intel dev) an update on progress...

venzislav commented 3 years ago

Please fix it https://github.com/Xiaogang-Li :)

Xiaogangli-intel commented 3 years ago

1215 this will fix the 8-bit encoding issue for HEVC. If you met this issue, please try this PR.

And 10-bit encoding should work. If you still meet encoding issue on GLK, please send out your command line, then I will check it. Thank you!

Xiaogangli-intel commented 3 years ago

1215 is merged, I will close this issue in two days if no more questions. Please file a new one if you still meet other issues of GLK.

Thank you.

Jqh63 commented 3 years ago

Seems OK now on last LSIO Plex from 4K HDR H265 to 1080p H264 using HW, nice!

BjoernUsw commented 2 years ago

Just checked with the latest Version of Plex for DSM6 on an DS920+ (Plex 1.25.4.5487). Trying to transcode 1080p H265 to 1080p H264 to burn in ASS subtitles for streaming to android devices still buffers every 5 seconds for at least 20 seconds using the iHD_drv_video.so but works fine with the i965_drv_video.so.

Xiaogangli-intel commented 2 years ago

@BjoernUsw could you provide some logs and dmesg result? Thank you.

ofsaleem commented 2 years ago

Just checked with the latest Version of Plex for DSM6 on an DS920+ (Plex 1.25.4.5487). Trying to transcode 1080p H265 to 1080p H264 to burn in ASS subtitles for streaming to android devices still buffers every 5 seconds for at least 20 seconds using the iHD_drv_video.so but works fine with the i965_drv_video.so.

i can confirm im having this problem on a qnap ts-653D with plex to any client that isnt directplaying, even for 2mbps 720p files. putting VaapiDriver="i965" at the end of the Preferences.xml file in my server folder completely solved the issue

i don't really understand how to tell what version of the ihd driver i have or how to upgrade it if i need to, to make sure im using a version with the fix. im new to NASes and all the online information is about synology devices, and i can't figure out how to see driver version information on the qnap OS.

robertofabrizi commented 2 years ago

Almost two years and Intel hasn't fixed this yet?

Xiaogangli-intel commented 2 years ago

This issue should be fixed. If you still meet this issue, please try the latest driver. If still cannot solve issue by updating driver, please provide your environment detail(app/driver/KMD version and logs). Thank you.