Best way to get Intel QSV working right in Linux on GUI

Support for HandBrake on Linux, Solaris, and other Unix-like platforms
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
F J Walter
Posts: 18
Joined: Tue Jul 29, 2014 4:08 am

Best way to get Intel QSV working right in Linux on GUI

Post by F J Walter »

Description of problem or question:

I haven't been able to find a way of getting QSV to work on Linux where h.264 works. h.265 (HEVC) is ok, but for h.264 the encode fails after a few seconds. The error shown in the activity log varies but is always accompanied by "(-21)".

The portion it encoded before it failed looks fine, and seems to be a perfectly valid video, except that it's only the first few seconds.

There is some intermittance in this issue. Sometimes it fails before encoding any, but it always fails at some stage near the start of the video, within the first 6 seconds or so of footage.

Steps to reproduce the problem (If Applicable):

Install flatpak Handbrake and Intel Media SDK. Use 1080p source, and encode to Intel QSV h.264.

Encoding on a Gemini Lake processor (same generation as Kaby Lake).

HandBrake version (e.g., 1.0.0):

Tried 1.3.3 and nightly with same result. Tried both the flathub and downloadable flatpak version of 1.3.3.


Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):

Debian stable (Buster) but with backported modern kernel.


HandBrake Activity Log ***required*** (see How-to get an activity log)

WILL EDIT THIS WITH THE ACTIVITY LOG - PLEASE STAY TUNED
F J Walter
Posts: 18
Joined: Tue Jul 29, 2014 4:08 am

Re: Best way to get Intel QSV working right in Linux on GUI

Post by F J Walter »

Activity log:

Code: Select all

[11:03:33] gtkgui: HandBrake 1.3.3 (2020061500) - Linux x86_64 - https://handbrake.fr
[11:03:33] hb_display_init: attempting VA driver 'iHD'
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/intel-vaapi-driver/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_5
libva info: va_openDriver() returns 0
Cannot load libnvidia-encode.so.1
[11:03:33] hb_init: starting libhb thread
[11:03:33] hb_init: starting libhb thread
[11:03:33] hb_init: starting libhb thread
[11:03:44] CPU: Intel(R) Pentium(R) Silver N5000 CPU @ 1.10GHz
[11:03:44]  - logical processor count: 4
[11:03:44] Intel Quick Sync Video support: yes
[11:03:44]  - Intel Media SDK hardware: API 1.32 (minimum: 1.3)
[11:03:44]  - H.264 encoder: yes
[11:03:44]     - preferred implementation: hardware (any) via ANY
[11:03:44]     - capabilities (hardware):  breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice
[11:03:44]  - H.265 encoder: yes (8bit: yes, 10bit: yes)
[11:03:44]     - preferred implementation: hardware (any) via ANY
[11:03:44]     - capabilities (hardware):  bpyramid icq vsinfo opt1
[11:03:44] hb_scan: path=/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v, title_index=0
udfread ERROR: ECMA 167 Volume Recognition failed
disc.c:323: failed opening UDF image /home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v
disc.c:424: error opening file BDMV/index.bdmv
disc.c:424: error opening file BDMV/BACKUP/index.bdmv
bluray.c:2585: nav_get_title_list(/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v/) failed
[11:03:44] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[11:03:44] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2020-09-07T08:00:54.000000Z
    encoder         : HandBrake 1.3.3 2020061300
  Duration: 00:00:23.70, start: 0.000000, bitrate: 22288 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1014 [SAR 1:1 DAR 320:169], 22037 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2020-09-07T08:00:54.000000Z
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 253 kb/s (default)
    Metadata:
      creation_time   : 2020-09-07T08:00:54.000000Z
      handler_name    : Stereo
      title           : Stereo
[11:03:44] scan: decoding previews for title 1
[11:03:44] scan: audio 0x1: aac, rate=48000Hz, bitrate=253375 Unknown (AAC LC) (2.0 ch) (253 kbps)
[11:03:45] scan: 5 previews, 1920x1014, 29.970 fps, autocrop = 0/0/0/0, aspect 1.89:1, PAR 1:1
[11:03:45] scan: supported video decoders: avcodec qsv
[11:03:45] libhb: scan thread found 1 valid title(s)
[11:03:54] gtkgui: Custom Preset: /General/TRUT1 1080p max QSV
[11:03:54] Starting work at: Tue Sep  8 11:03:54 2020

[11:03:54] 1 job(s) to process
[11:03:54] json job:
{
    "Audio": {
        "AudioList": [
            {
                "Bitrate": 224,
                "CompressionLevel": -1.0,
                "DRC": 0.0,
                "DitherMethod": "auto",
                "Encoder": "av_aac",
                "Gain": 0.0,
                "Mixdown": "stereo",
                "Name": "Stereo",
                "NormalizeMixLevel": false,
                "PresetEncoder": "av_aac",
                "Quality": -3.0,
                "Samplerate": 0,
                "Track": 0
            }
        ],
        "CopyMask": [
            "copy:aac"
        ],
        "FallbackEncoder": "av_aac"
    },
    "Destination": {
        "AlignAVStart": true,
        "ChapterList": [
            {
                "Duration": {
                    "Hours": 0,
                    "Minutes": 0,
                    "Seconds": 23,
                    "Ticks": 2133180
                },
                "Name": ""
            }
        ],
        "ChapterMarkers": false,
        "File": "/home/trutter/Videos/1080p sample 1 (2).mp4",
        "InlineParameterSets": false,
        "Mp4Options": {
            "IpodAtom": false,
            "Mp4Optimize": true
        },
        "Mux": "m4v"
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 6,
                "Settings": {
                    "mode": 1
                }
            },
            {
                "ID": 12,
                "Settings": {
                    "crop-bottom": 0,
                    "crop-left": 0,
                    "crop-right": 0,
                    "crop-top": 0,
                    "height": 1014,
                    "width": 1920
                }
            }
        ]
    },
    "Metadata": {
        "Name": "1080p sample 1"
    },
    "PAR": {
        "Den": 1,
        "Num": 1
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "Path": "/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v",
        "Range": {
            "End": 1,
            "Start": 1,
            "Type": "chapter"
        },
        "Title": 1
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": false,
            "Forced": false
        },
        "SubtitleList": []
    },
    "Video": {
        "ColorFormat": 0,
        "ColorMatrix": 1,
        "ColorPrimaries": 1,
        "ColorRange": 1,
        "ColorTransfer": 1,
        "Encoder": "qsv_h264",
        "Level": "4.1",
        "Options": "",
        "Preset": "quality",
        "Profile": "high",
        "QSV": {
            "AsyncDepth": 4,
            "Decode": false
        },
        "Quality": 24.0,
        "Tune": "",
        "Turbo": false,
        "TwoPass": false
    }
}
[11:03:54] CPU: Intel(R) Pentium(R) Silver N5000 CPU @ 1.10GHz
[11:03:54]  - logical processor count: 4
[11:03:54] Intel Quick Sync Video support: yes
[11:03:54]  - Intel Media SDK hardware: API 1.32 (minimum: 1.3)
[11:03:54]  - H.264 encoder: yes
[11:03:54]     - preferred implementation: hardware (any) via ANY
[11:03:54]     - capabilities (hardware):  breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice
[11:03:54]  - H.265 encoder: yes (8bit: yes, 10bit: yes)
[11:03:54]     - preferred implementation: hardware (any) via ANY
[11:03:54]     - capabilities (hardware):  bpyramid icq vsinfo opt1
[11:03:54] hb_scan: path=/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
disc.c:323: failed opening UDF image /home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v
disc.c:424: error opening file BDMV/index.bdmv
disc.c:424: error opening file BDMV/BACKUP/index.bdmv
bluray.c:2585: nav_get_title_list(/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v/) failed
[11:03:54] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[11:03:54] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2020-09-07T08:00:54.000000Z
    encoder         : HandBrake 1.3.3 2020061300
  Duration: 00:00:23.70, start: 0.000000, bitrate: 22288 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1014 [SAR 1:1 DAR 320:169], 22037 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2020-09-07T08:00:54.000000Z
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 253 kb/s (default)
    Metadata:
      creation_time   : 2020-09-07T08:00:54.000000Z
      handler_name    : Stereo
      title           : Stereo
[11:03:54] scan: decoding previews for title 1
[11:03:54] scan: audio 0x1: aac, rate=48000Hz, bitrate=253375 Unknown (AAC LC) (2.0 ch) (253 kbps)
[11:03:56] scan: 10 previews, 1920x1014, 29.970 fps, autocrop = 0/0/0/0, aspect 1.89:1, PAR 1:1
[11:03:56] scan: supported video decoders: avcodec qsv
[11:03:56] libhb: scan thread found 1 valid title(s)
[11:03:56] Starting Task: Encoding Pass
[11:03:56] Skipping crop/scale filter
[11:03:56] job configuration:
[11:03:56]  * source
[11:03:56]    + /home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v
[11:03:56]    + title 1, chapter(s) 1 to 1
[11:03:56]    + container: mov,mp4,m4a,3gp,3g2,mj2
[11:03:56]    + data rate: 22288 kbps
[11:03:56]  * destination
[11:03:56]    + /home/trutter/Videos/1080p sample 1 (2).mp4
[11:03:56]    + container: MPEG-4 (libavformat)
[11:03:56]      + optimized for HTTP streaming (fast start)
[11:03:56]      + align initial A/V stream timestamps
[11:03:56]  * video track
[11:03:56]    + decoder: h264
[11:03:56]      + bitrate 22037 kbps
[11:03:56]    + filter
[11:03:56]      + Framerate Shaper (mode=1)
[11:03:56]        + frame rate: 29.970 fps -> constant 29.970 fps
[11:03:56]    + Output geometry
[11:03:56]      + storage dimensions: 1920 x 1014
[11:03:56]      + pixel aspect ratio: 1 : 1
[11:03:56]      + display dimensions: 1920 x 1014
[11:03:56]    + encoder: H.264 (Intel Media SDK)
[11:03:56]      + preset:  quality
[11:03:56]      + profile: high
[11:03:56]      + level:   4.1
[11:03:56]      + quality: 24.00 (ICQ)
[11:03:56]      + color profile: 1-1-1
[11:03:56]  * audio track 1
[11:03:56]    + name: Stereo
[11:03:56]    + decoder: Unknown (AAC LC) (2.0 ch) (253 kbps) (track 1, id 0x1)
[11:03:56]      + bitrate: 253 kbps, samplerate: 48000 Hz
[11:03:56]    + mixdown: Stereo
[11:03:56]    + dither: triangular
[11:03:56]    + encoder: AAC (libavcodec)
[11:03:56]      + bitrate: 224 kbps, samplerate: 48000 Hz
[11:03:56] sync: expecting 710 video frames
[11:03:56] hb_display_init: using VA driver 'iHD'
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/intel-vaapi-driver/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_5
libva info: va_openDriver() returns 0
[11:03:56] encqsvInit: MFXVideoENCODE_Init failed (-1)
[11:03:56] Failure to initialise thread 'Quick Sync Video encoder (Intel Media SDK)'
[11:03:56] vfr: 0 frames output, 0 dropped and 0 duped for CFR/PFR
[11:03:56] vfr: lost time: 0 (0 frames)
[11:03:56] vfr: gained time: 0 (0 frames) (0 not accounted for)
[11:03:56] aac-decoder done: 0 frames, 0 decoder errors
[11:03:56] h264-decoder done: 0 frames, 0 decoder errors
[11:03:56] sync: got 0 frames, 710 expected
[11:03:56] Finished work at: Tue Sep  8 11:03:56 2020

[11:03:56] libhb: work result = 3
[11:04:12] gtkgui: Modified Custom Preset: /General/TRUT1 1080p max QSV
[11:04:12] Starting work at: Tue Sep  8 11:04:12 2020

[11:04:12] 1 job(s) to process
[11:04:12] json job:
{
    "Audio": {
        "AudioList": [
            {
                "Bitrate": 224,
                "CompressionLevel": -1.0,
                "DRC": 0.0,
                "DitherMethod": "auto",
                "Encoder": "av_aac",
                "Gain": 0.0,
                "Mixdown": "stereo",
                "Name": "Stereo",
                "NormalizeMixLevel": false,
                "PresetEncoder": "av_aac",
                "Quality": -3.0,
                "Samplerate": 0,
                "Track": 0
            }
        ],
        "CopyMask": [
            "copy:aac"
        ],
        "FallbackEncoder": "av_aac"
    },
    "Destination": {
        "AlignAVStart": true,
        "ChapterList": [
            {
                "Duration": {
                    "Hours": 0,
                    "Minutes": 0,
                    "Seconds": 23,
                    "Ticks": 2133180
                },
                "Name": ""
            }
        ],
        "ChapterMarkers": false,
        "File": "/home/trutter/Videos/1080p sample 1 (2).mp4",
        "InlineParameterSets": false,
        "Mp4Options": {
            "IpodAtom": false,
            "Mp4Optimize": true
        },
        "Mux": "m4v"
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 6,
                "Settings": {
                    "mode": 1
                }
            },
            {
                "ID": 12,
                "Settings": {
                    "crop-bottom": 0,
                    "crop-left": 0,
                    "crop-right": 0,
                    "crop-top": 0,
                    "height": 1014,
                    "width": 1920
                }
            }
        ]
    },
    "Metadata": {
        "Name": "1080p sample 1"
    },
    "PAR": {
        "Den": 1,
        "Num": 1
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "Path": "/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v",
        "Range": {
            "End": 1,
            "Start": 1,
            "Type": "chapter"
        },
        "Title": 1
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": false,
            "Forced": false
        },
        "SubtitleList": []
    },
    "Video": {
        "ColorFormat": 0,
        "ColorMatrix": 1,
        "ColorPrimaries": 1,
        "ColorRange": 1,
        "ColorTransfer": 1,
        "Encoder": "qsv_h265",
        "Level": "auto",
        "Options": "",
        "Preset": "balanced",
        "Profile": "auto",
        "QSV": {
            "AsyncDepth": 4,
            "Decode": false
        },
        "Quality": 16.0,
        "Tune": "",
        "Turbo": false,
        "TwoPass": false
    }
}
[11:04:12] CPU: Intel(R) Pentium(R) Silver N5000 CPU @ 1.10GHz
[11:04:12]  - logical processor count: 4
[11:04:12] Intel Quick Sync Video support: yes
[11:04:12]  - Intel Media SDK hardware: API 1.32 (minimum: 1.3)
[11:04:12]  - H.264 encoder: yes
[11:04:12]     - preferred implementation: hardware (any) via ANY
[11:04:12]     - capabilities (hardware):  breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice
[11:04:12]  - H.265 encoder: yes (8bit: yes, 10bit: yes)
[11:04:12]     - preferred implementation: hardware (any) via ANY
[11:04:12]     - capabilities (hardware):  bpyramid icq vsinfo opt1
[11:04:12] hb_scan: path=/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
disc.c:323: failed opening UDF image /home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v
disc.c:424: error opening file BDMV/index.bdmv
disc.c:424: error opening file BDMV/BACKUP/index.bdmv
bluray.c:2585: nav_get_title_list(/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v/) failed
[11:04:12] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[11:04:12] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2020-09-07T08:00:54.000000Z
    encoder         : HandBrake 1.3.3 2020061300
  Duration: 00:00:23.70, start: 0.000000, bitrate: 22288 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1014 [SAR 1:1 DAR 320:169], 22037 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2020-09-07T08:00:54.000000Z
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 253 kb/s (default)
    Metadata:
      creation_time   : 2020-09-07T08:00:54.000000Z
      handler_name    : Stereo
      title           : Stereo
[11:04:12] scan: decoding previews for title 1
[11:04:12] scan: audio 0x1: aac, rate=48000Hz, bitrate=253375 Unknown (AAC LC) (2.0 ch) (253 kbps)
[11:04:13] scan: 10 previews, 1920x1014, 29.970 fps, autocrop = 0/0/0/0, aspect 1.89:1, PAR 1:1
[11:04:13] scan: supported video decoders: avcodec qsv
[11:04:13] libhb: scan thread found 1 valid title(s)
[11:04:13] Starting Task: Encoding Pass
[11:04:13] Skipping crop/scale filter
[11:04:13] job configuration:
[11:04:13]  * source
[11:04:13]    + /home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v
[11:04:13]    + title 1, chapter(s) 1 to 1
[11:04:13]    + container: mov,mp4,m4a,3gp,3g2,mj2
[11:04:13]    + data rate: 22288 kbps
[11:04:13]  * destination
[11:04:13]    + /home/trutter/Videos/1080p sample 1 (2).mp4
[11:04:13]    + container: MPEG-4 (libavformat)
[11:04:13]      + optimized for HTTP streaming (fast start)
[11:04:13]      + align initial A/V stream timestamps
[11:04:13]  * video track
[11:04:13]    + decoder: h264
[11:04:13]      + bitrate 22037 kbps
[11:04:13]    + filter
[11:04:13]      + Framerate Shaper (mode=1)
[11:04:13]        + frame rate: 29.970 fps -> constant 29.970 fps
[11:04:13]    + Output geometry
[11:04:13]      + storage dimensions: 1920 x 1014
[11:04:13]      + pixel aspect ratio: 1 : 1
[11:04:13]      + display dimensions: 1920 x 1014
[11:04:13]    + encoder: H.265 (Intel Media SDK)
[11:04:13]      + preset:  balanced
[11:04:13]      + profile: auto
[11:04:13]      + level:   auto
[11:04:13]      + quality: 16.00 (ICQ)
[11:04:13]      + color profile: 1-1-1
[11:04:13]  * audio track 1
[11:04:13]    + name: Stereo
[11:04:13]    + decoder: Unknown (AAC LC) (2.0 ch) (253 kbps) (track 1, id 0x1)
[11:04:13]      + bitrate: 253 kbps, samplerate: 48000 Hz
[11:04:13]    + mixdown: Stereo
[11:04:13]    + dither: triangular
[11:04:13]    + encoder: AAC (libavcodec)
[11:04:13]      + bitrate: 224 kbps, samplerate: 48000 Hz
[11:04:13] sync: expecting 710 video frames
[11:04:13] hb_display_init: using VA driver 'iHD'
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/intel-vaapi-driver/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_5
libva info: va_openDriver() returns 0
[11:04:13] encqsvInit: using encode-only path
[11:04:13] encqsvInit: H.265/HEVC Main profile @ level (null)
[11:04:13] encqsvInit: TargetUsage 4 AsyncDepth 4
[11:04:13] encqsvInit: GopRefDist 3 GopPicSize 30 NumRefFrame 2
[11:04:13] encqsvInit: BFramesMax 2 BRefType off
[11:04:13] encqsvInit: RateControlMethod ICQ ICQQuality 16
[11:04:14] sync: first pts video is 0
[11:04:14] sync: Chapter 1 at frame 1 time 0
[11:04:14] sync: first pts audio 0x1 is 0
[11:04:14] qsv_enc_init: using 'hardware (1) via VAAPI' implementation, API: 1.32
[11:04:22] work: average encoding speed for job is 30.817039 fps
[11:04:22] vfr: 227 frames output, 0 dropped and 0 duped for CFR/PFR
[11:04:22] vfr: lost time: 0 (0 frames)
[11:04:22] vfr: gained time: 0 (0 frames) (0 not accounted for)
[11:04:22] aac-decoder done: 460 frames, 0 decoder errors
[11:04:22] h264-decoder done: 280 frames, 0 decoder errors
[11:04:22] sync: got 240 frames, 710 expected
[11:04:22] sync: framerate min 29.970 fps, max 29.970 fps, avg 29.970 fps
[11:04:22] mux: track 0, 215 frames, 9337479 bytes, 9367.18 kbps, fifo 256
[11:04:22] mux: track 1, 373 frames, 2272 bytes, 2.28 kbps, fifo 512
[11:04:22] Finished work at: Tue Sep  8 11:04:22 2020

[11:04:22] libhb: work result = 1
[11:04:32] gtkgui: Modified Custom Preset: /General/TRUT1 1080p max QSV
[11:04:32] Starting work at: Tue Sep  8 11:04:32 2020

[11:04:32] 1 job(s) to process
[11:04:32] json job:
{
    "Audio": {
        "AudioList": [
            {
                "Bitrate": 224,
                "CompressionLevel": -1.0,
                "DRC": 0.0,
                "DitherMethod": "auto",
                "Encoder": "av_aac",
                "Gain": 0.0,
                "Mixdown": "stereo",
                "Name": "Stereo",
                "NormalizeMixLevel": false,
                "PresetEncoder": "av_aac",
                "Quality": -3.0,
                "Samplerate": 0,
                "Track": 0
            }
        ],
        "CopyMask": [
            "copy:aac"
        ],
        "FallbackEncoder": "av_aac"
    },
    "Destination": {
        "AlignAVStart": true,
        "ChapterList": [
            {
                "Duration": {
                    "Hours": 0,
                    "Minutes": 0,
                    "Seconds": 23,
                    "Ticks": 2133180
                },
                "Name": ""
            }
        ],
        "ChapterMarkers": false,
        "File": "/home/trutter/Videos/1080p sample 1 (2).mp4",
        "InlineParameterSets": false,
        "Mp4Options": {
            "IpodAtom": false,
            "Mp4Optimize": true
        },
        "Mux": "m4v"
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 6,
                "Settings": {
                    "mode": 1
                }
            },
            {
                "ID": 12,
                "Settings": {
                    "crop-bottom": 0,
                    "crop-left": 0,
                    "crop-right": 0,
                    "crop-top": 0,
                    "height": 1014,
                    "width": 1920
                }
            }
        ]
    },
    "Metadata": {
        "Name": "1080p sample 1"
    },
    "PAR": {
        "Den": 1,
        "Num": 1
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "Path": "/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v",
        "Range": {
            "End": 1,
            "Start": 1,
            "Type": "chapter"
        },
        "Title": 1
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": false,
            "Forced": false
        },
        "SubtitleList": []
    },
    "Video": {
        "ColorFormat": 0,
        "ColorMatrix": 1,
        "ColorPrimaries": 1,
        "ColorRange": 1,
        "ColorTransfer": 1,
        "Encoder": "qsv_h264",
        "Level": "auto",
        "Options": "",
        "Preset": "balanced",
        "Profile": "auto",
        "QSV": {
            "AsyncDepth": 4,
            "Decode": false
        },
        "Quality": 16.0,
        "Tune": "",
        "Turbo": false,
        "TwoPass": false
    }
}
[11:04:32] CPU: Intel(R) Pentium(R) Silver N5000 CPU @ 1.10GHz
[11:04:32]  - logical processor count: 4
[11:04:32] Intel Quick Sync Video support: yes
[11:04:32]  - Intel Media SDK hardware: API 1.32 (minimum: 1.3)
[11:04:32]  - H.264 encoder: yes
[11:04:32]     - preferred implementation: hardware (any) via ANY
[11:04:32]     - capabilities (hardware):  breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice
[11:04:32]  - H.265 encoder: yes (8bit: yes, 10bit: yes)
[11:04:32]     - preferred implementation: hardware (any) via ANY
[11:04:32]     - capabilities (hardware):  bpyramid icq vsinfo opt1
[11:04:32] hb_scan: path=/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
disc.c:323: failed opening UDF image /home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v
disc.c:424: error opening file BDMV/index.bdmv
disc.c:424: error opening file BDMV/BACKUP/index.bdmv
bluray.c:2585: nav_get_title_list(/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v/) failed
[11:04:32] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[11:04:32] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2020-09-07T08:00:54.000000Z
    encoder         : HandBrake 1.3.3 2020061300
  Duration: 00:00:23.70, start: 0.000000, bitrate: 22288 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1014 [SAR 1:1 DAR 320:169], 22037 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2020-09-07T08:00:54.000000Z
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 253 kb/s (default)
    Metadata:
      creation_time   : 2020-09-07T08:00:54.000000Z
      handler_name    : Stereo
      title           : Stereo
[11:04:32] scan: decoding previews for title 1
[11:04:32] scan: audio 0x1: aac, rate=48000Hz, bitrate=253375 Unknown (AAC LC) (2.0 ch) (253 kbps)
[11:04:33] scan: 10 previews, 1920x1014, 29.970 fps, autocrop = 0/0/0/0, aspect 1.89:1, PAR 1:1
[11:04:33] scan: supported video decoders: avcodec qsv
[11:04:33] libhb: scan thread found 1 valid title(s)
[11:04:33] Starting Task: Encoding Pass
[11:04:33] Skipping crop/scale filter
[11:04:33] job configuration:
[11:04:33]  * source
[11:04:33]    + /home/trutter/Dropbox/Util/Handbrake/sample/1080p sample 1.m4v
[11:04:33]    + title 1, chapter(s) 1 to 1
[11:04:33]    + container: mov,mp4,m4a,3gp,3g2,mj2
[11:04:33]    + data rate: 22288 kbps
[11:04:33]  * destination
[11:04:33]    + /home/trutter/Videos/1080p sample 1 (2).mp4
[11:04:33]    + container: MPEG-4 (libavformat)
[11:04:33]      + optimized for HTTP streaming (fast start)
[11:04:33]      + align initial A/V stream timestamps
[11:04:33]  * video track
[11:04:33]    + decoder: h264
[11:04:33]      + bitrate 22037 kbps
[11:04:33]    + filter
[11:04:33]      + Framerate Shaper (mode=1)
[11:04:33]        + frame rate: 29.970 fps -> constant 29.970 fps
[11:04:33]    + Output geometry
[11:04:33]      + storage dimensions: 1920 x 1014
[11:04:33]      + pixel aspect ratio: 1 : 1
[11:04:33]      + display dimensions: 1920 x 1014
[11:04:33]    + encoder: H.264 (Intel Media SDK)
[11:04:33]      + preset:  balanced
[11:04:33]      + profile: auto
[11:04:33]      + level:   auto
[11:04:33]      + quality: 16.00 (ICQ)
[11:04:33]      + color profile: 1-1-1
[11:04:33]  * audio track 1
[11:04:33]    + name: Stereo
[11:04:33]    + decoder: Unknown (AAC LC) (2.0 ch) (253 kbps) (track 1, id 0x1)
[11:04:33]      + bitrate: 253 kbps, samplerate: 48000 Hz
[11:04:33]    + mixdown: Stereo
[11:04:33]    + dither: triangular
[11:04:33]    + encoder: AAC (libavcodec)
[11:04:33]      + bitrate: 224 kbps, samplerate: 48000 Hz
[11:04:33] sync: expecting 710 video frames
[11:04:33] hb_display_init: using VA driver 'iHD'
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/intel-vaapi-driver/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_5
libva info: va_openDriver() returns 0
[11:04:33] encqsvInit: using encode-only path
[11:04:33] encqsvInit: H.264/AVC High profile @ level 4.0
[11:04:33] encqsvInit: TargetUsage 4 AsyncDepth 4
[11:04:33] encqsvInit: GopRefDist 3 GopPicSize 30 NumRefFrame 1
[11:04:33] encqsvInit: BFramesMax 2 BRefType off
[11:04:33] encqsvInit: RateControlMethod ICQ ICQQuality 16
[11:04:33] sync: first pts video is 0
[11:04:33] sync: Chapter 1 at frame 1 time 0
[11:04:33] sync: first pts audio 0x1 is 0
[11:04:34] qsv_enc_init: using 'hardware (1) via VAAPI' implementation, API: 1.32
[11:04:35] encqsv: MFXVideoENCODE_EncodeFrameAsync failed (-21)
[11:04:35] work: average encoding speed for job is 0.000000 fps
[11:04:35] vfr: 90 frames output, 0 dropped and 0 duped for CFR/PFR
[11:04:35] vfr: lost time: 0 (0 frames)
[11:04:35] vfr: gained time: 0 (0 frames) (0 not accounted for)
[11:04:35] aac-decoder done: 199 frames, 0 decoder errors
[11:04:35] h264-decoder done: 126 frames, 0 decoder errors
[11:04:35] sync: got 94 frames, 710 expected
[11:04:35] sync: framerate min 29.970 fps, max 29.970 fps, avg 29.970 fps
[11:04:35] mux: track 0, 70 frames, 4072797 bytes, 10388.24 kbps, fifo 128
[11:04:35] mux: track 1, 147 frames, 899 bytes, 2.29 kbps, fifo 256
[11:04:35] Finished work at: Tue Sep  8 11:04:35 2020

[11:04:35] libhb: work result = 4
F J Walter
Posts: 18
Joined: Tue Jul 29, 2014 4:08 am

Re: Best way to get Intel QSV working right in Linux on GUI

Post by F J Walter »

Looks like the activity log includes a successful h.265 encode as well as the failed h.264. The problematic one is at the bottom of the log.
Deleted User 13735

Re: Best way to get Intel QSV working right in Linux on GUI

Post by Deleted User 13735 »

If you end up spending a lot of time on this, you're going to wish you hadn't.
QSV is an absolutely horrid encoder, and that goes ^10 for h264. You'll need to run at ~CQ12, or about 1.5 - 2x the file size of x264 to even get "close."
F J Walter
Posts: 18
Joined: Tue Jul 29, 2014 4:08 am

Re: Best way to get Intel QSV working right in Linux on GUI

Post by F J Walter »

I appreciate the advice. I did manage to get it working in ffmpeg using va-api. Your point about it being a higher file size for suitable quality compared to x264 seems legit. Still, it seems like a reasonable trade-off when space isn't too much of a premium, and it looks like QSV has improved quality a lot since I tried it on Sandy Bridge a long time ago, especially the new ICQ rate control. I'll be investigating more, but my expectations are realistic.
Deleted User 13735

Re: Best way to get Intel QSV working right in Linux on GUI

Post by Deleted User 13735 »

Yes, your expectations for speed are realistic.
Post Reply