jlesage / docker-handbrake

Docker container for HandBrake
MIT License
813 stars 94 forks source link

Intel QSV H.264 Not Working: MFXVideoENCODE_Init failed (-15) #138

Open keysun11952 opened 4 years ago

keysun11952 commented 4 years ago

I was trying to use Intel QSV to speed up H.264 video encoding, but it never worked. I am using an 4785T CPU and integrated graphics only, on Debian 10 based Openmediavault 5 (OMV). I had the i915 and i965 driver installed, and was able to see the H.264 (QSV) option in the handbrake container. Here is the part of the log output for the failing encoding task:

[18:38:16] sync: expecting 32040 video frames [18:38:16] hb_display_init: using VA driver 'i965' libva info: VA-API version 1.7.0 libva info: User environment variable requested driver 'i965' libva info: Trying to open /opt/intel/mediasdk/lib64/i965_drv_video.so libva info: Found init function __vaDriverInit_1_7 libva info: va_openDriver() returns 0 [18:38:16] encqsvInit: MFXVideoENCODE_Init failed (-15) [18:38:16] Failure to initialise thread 'Quick Sync Video encoder (Intel Media SDK)' [18:38:16] vfr: 0 frames output, 0 dropped and 0 duped for CFR/PFR [18:38:16] vfr: lost time: 0 (0 frames) [18:38:16] vfr: gained time: 0 (0 frames) (0 not accounted for) [18:38:16] pcm_s16le-decoder done: 0 frames, 0 decoder errors [18:38:16] h264-decoder done: 0 frames, 0 decoder errors [18:38:16] sync: got 0 frames, 32040 expected [18:38:16] Finished work at: Thu Jul 16 18:38:16 2020 [18:38:16] libhb: work result = 3

I followed every step in the documentation, and even created the docker container several times. Any help would be greatly appreciated. Thanks in advance!

jlesage commented 4 years ago

Can you provide the output of docker inspect <name of your container> ?

keysun11952 commented 4 years ago

inspect.txt Thanks in advance!

jlesage commented 4 years ago

Can you try versions 1.22.2 and 1.21.0 to see if one is working?

keysun11952 commented 4 years ago

Tried version 1.21.0, still didn't work.

keysun11952 commented 4 years ago

Also tried 1.22.2 and got no luck on that either.

jlesage commented 4 years ago

It's probably an issue with Handbrake/Intel Media SDK with your particular CPU... I will soon publish a new image with the latest Intel Media SDK, hoping this will help.

keysun11952 commented 4 years ago

Thanks! Will update the image as soon as its release.

jlesage commented 4 years ago

Can you try the latest image (v1.22.4) ?

adt7sy commented 4 years ago

Hi I have the same problem on the last image (v1.22.4) .

My system Synology 720+ [11:09:23] CPU: Intel(R) Celeron(R) J4125 CPU @ 2.00GHz [11:09:23] - logical processor count: 4 [11:09:23] Intel Quick Sync Video support: yes [11:09:23] - Intel Media SDK hardware: API 1.33 (minimum: 1.3) [11:09:23] - H.264 encoder: yes [11:09:23] - preferred implementation: hardware (any) via ANY [11:09:23] - capabilities (hardware): breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice [11:09:23] - H.265 encoder: yes (8bit: yes, 10bit: yes) [11:09:23] - preferred implementation: hardware (any) via ANY [11:09:23] - capabilities (hardware): bpyramid icq vsinfo opt1

and have these errors starting from Gui

[10:32:21] sync: expecting 128558 video frames [10:32:21] hb_display_init: using VA driver 'iHD' libva info: VA-API version 1.8.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_8 libva info: va_openDriver() returns 0 [10:32:21] encqsvInit: using encode-only path [10:32:21] encqsvInit: H.264/AVC High profile @ level 3.0 [10:32:21] encqsvInit: TargetUsage 4 AsyncDepth 4 [10:32:21] encqsvInit: GopRefDist 3 GopPicSize 24 NumRefFrame 1 [10:32:21] encqsvInit: BFramesMax 2 BRefType off [10:32:21] encqsvInit: RateControlMethod ICQ ICQQuality 16 [10:32:21] sync: first pts video is 0 [10:32:21] sync: Chapter 1 at frame 1 time 0 [10:32:21] sync: first pts audio 0x1 is 0 [10:32:22] qsv_enc_init: using 'hardware (1) via VAAPI' implementation, API: 1.33 Error code -21, hb_qsv_wait_on_sync 605 [10:32:22] encqsv: MFXVideoENCODE_EncodeFrameAsync failed (-21) [10:32:22] work: average encoding speed for job is 0.000000 fps

or

[08:43:22] sync: expecting 187505 video frames [08:43:22] hb_display_init: using VA driver 'iHD' libva info: VA-API version 1.8.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_8 libva info: va_openDriver() returns 0 [08:43:22] encqsvInit: using encode-only path [08:43:22] encqsvInit: H.264/AVC High profile @ level 3.0 [08:43:22] encqsvInit: TargetUsage 4 AsyncDepth 4 [08:43:22] encqsvInit: GopRefDist 3 GopPicSize 24 NumRefFrame 1 [08:43:22] encqsvInit: BFramesMax 2 BRefType off [08:43:22] encqsvInit: RateControlMethod ICQ ICQQuality 16 [08:43:22] sync: first pts video is 0 [08:43:22] sync: Chapter 1 at frame 1 time 0 [08:43:22] sync: first pts audio 0x1 is 0 [08:43:22] qsv_enc_init: using 'hardware (1) via VAAPI' implementation, API: 1.33 Error code -17, hb_qsv_wait_on_sync 605 [08:43:22] encqsv: MFXVideoENCODE_EncodeFrameAsync failed (-17) [08:43:23] work: average encoding speed for job is 0.000000 fps

Thanks a lot

keysun11952 commented 4 years ago

I got the exact same behavior from version 1.22.4

... [20:40:12] sync: expecting 14280 video frames [20:40:12] hb_display_init: using VA driver 'i965' libva info: VA-API version 1.8.0 libva info: User environment variable requested driver 'i965' libva info: Trying to open /opt/intel/mediasdk/lib64/i965_drv_video.so libva info: Found init function __vaDriverInit_1_8 libva info: va_openDriver() returns 0 [20:40:12] encqsvInit: MFXVideoENCODE_Init failed (-15) [20:40:12] Failure to initialise thread 'Quick Sync Video encoder (Intel Media SDK)' [20:40:12] vfr: 0 frames output, 0 dropped and 0 duped for CFR/PFR [20:40:12] vfr: lost time: 0 (0 frames) [20:40:12] vfr: gained time: 0 (0 frames) (0 not accounted for) [20:40:12] pcm_s16le-decoder done: 0 frames, 0 decoder errors [20:40:12] h264-decoder done: 0 frames, 0 decoder errors [20:40:12] sync: got 0 frames, 14280 expected ...

jlesage commented 4 years ago

@adt7sy, you issue looks like this one: https://github.com/HandBrake/HandBrake/issues/2745 Maybe check the version of your driver ?

@keysun11952, can you provide the output of docker inspect <name of the container> ?

keysun11952 commented 4 years ago

Here it is: inspect.txt I did a diff on this one and the one from the previous version. It seems that nothing related to the error has changed.

madeny commented 3 years ago

I'm having the same issue, but only with cli, everything works fine with GUI. I have created a custom preset and update my docker env variable for the presets but container is still using cpu! instead of QSV.