Opened 9 years ago

#5393 new enhancement

Option to select the Intel Quick Sync GPU device adapter for encoding

Reported by: beloko Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords: qsv gpu device id
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hello,

My Windows 7 (x64) computer has two HW accelerated video devices :
. an nVidia video card as the main display adapter (ID: 0)
. and iGPU used as extended display (ID: 1)

I would use FFMPEG to encode video files with Quick Sync Video.

Here is my FFMPEG command line :
ffmpeg.exe -i input.m2ts -c:v h264_qsv output.mp4

And then I get this error message :

[graph 0 input from stream 0:0 @ 0000000002c3bac0] w:3840 h:2160 pixfmt:yuv420p
tb:1/90000 fr:24000/1001 sar:1/1 sws_param:flags=2
[auto-inserted scaler 0 @ 0000000002a1ebc0] w:iw h:ih flags:'bicubic' interl:0
[format @ 0000000002c3bee0] auto-inserting filter 'auto-inserted scaler 0' betwe
en the filter 'Parsed_null_0' and the filter 'format'
[auto-inserted scaler 0 @ 0000000002a1ebc0] w:3840 h:2160 fmt:yuv420p sar:1/1 ->
 w:3840 h:2160 fmt:nv12 sar:1/1 flags:0x4
[graph 1 input from stream 0:1 @ 00000000029e8520] tb:1/44100 samplefmt:fltp sam
plerate:44100 chlayout:0x3
[h264_qsv @ 00000000004abea0] Initialized an internal MFX session using hardware
 accelerated implementation
[h264_qsv @ 00000000004abea0] Using the VBR with lookahead (LA) ratecontrol meth
od
[h264_qsv @ 00000000004abea0] Selected ratecontrol mode is not supported by the
QSV runtime. Choose a different mode.

Now, if I toggle my iGPU as the main display adapter (ID: 0) and my nVidia video card as extended display (ID: 1), my FFMPEG command line works properly. And the output.mp4 video file is encoded by Intel Quick Sync Video hardware unit.

FFMPEG can create a QSV HW encoding session because iGPU is set as ID: 0

[graph 0 input from stream 0:0 @ 0000000002d1bda0] w:3840 h:2160 pixfmt:yuv420p
tb:1/90000 fr:24000/1001 sar:1/1 sws_param:flags=2
[auto-inserted scaler 0 @ 0000000002afebc0] w:iw h:ih flags:'bicubic' interl:0
[format @ 0000000002afdc20] auto-inserting filter 'auto-inserted scaler 0' betwe
en the filter 'Parsed_null_0' and the filter 'format'
[auto-inserted scaler 0 @ 0000000002afebc0] w:3840 h:2160 fmt:yuv420p sar:1/1 ->
 w:3840 h:2160 fmt:nv12 sar:1/1 flags:0x4
[graph 1 input from stream 0:1 @ 0000000002ac8520] tb:1/44100 samplefmt:fltp sam
plerate:44100 chlayout:0x3
[h264_qsv @ 000000000058bea0] Initialized an internal MFX session using hardware
 accelerated implementation
[h264_qsv @ 000000000058bea0] Using the VBR with lookahead (LA) ratecontrol meth
od
[h264_qsv @ 000000000058bea0] profile: high; level: 51
[h264_qsv @ 000000000058bea0] GopPicSize: 250; GopRefDist: 4; GopOptFlag: closed
 ; IdrInterval: 0
[h264_qsv @ 000000000058bea0] TargetUsage: 4; RateControlMethod: LA
[h264_qsv @ 000000000058bea0] TargetKbps: 1000; LookAheadDepth: 40
[h264_qsv @ 000000000058bea0] NumSlice: 1; NumRefFrame: 2
[h264_qsv @ 000000000058bea0] RateDistortionOpt: OFF
[h264_qsv @ 000000000058bea0] RecoveryPointSEI: OFF IntRefType: 0; IntRefCycleSi
ze: 0; IntRefQPDelta: 0
[h264_qsv @ 000000000058bea0] MaxFrameSize: 6220800; MaxSliceSize: 0;
[h264_qsv @ 000000000058bea0] BitrateLimit: ON; MBBRC: OFF; ExtBRC: unknown
[h264_qsv @ 000000000058bea0] Trellis: auto
[h264_qsv @ 000000000058bea0] RepeatPPS: ON; NumMbPerSlice: 0; LookAheadDS: unkn
own
[h264_qsv @ 000000000058bea0] AdaptiveI: unknown; AdaptiveB: unknown; BRefType:
off
[h264_qsv @ 000000000058bea0] MinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0; MinQPB
: 0; MaxQPB: 0
[h264_qsv @ 000000000058bea0] Entropy coding: CABAC; MaxDecFrameBuffering: 2
[h264_qsv @ 000000000058bea0] NalHrdConformance: OFF; SingleSeiNalUnit: ON; VuiV
clHrdParameters: OFF VuiNalHrdParameters: OFF

Should be interesting to add an option to be able to select the iGPU video device by its Windows screen ID (like the -gpu option available in the NVENC codecs).

-gpu <int> E..V.... Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on. (from 0 to INT_MAX) (default 0)

Intel provide a tool to check iGPU capabilities in its Media SDK 2016 : \tools\mediasdk_sys_analyzer\mediasdk_system_analyzer_32.exe

Here is the report when iGPU is set as Windows main screen (ID: 0) :

Intel Media SDK System Analyzer (32 bit)


The following versions of Media SDK API are supported by platform/driver:

        Version Target  Supported       Dec     Enc
        1.0     HW      Yes             X       X
        1.0     SW      Yes             X       X
        1.1     HW      Yes             X       X
        1.1     SW      Yes             X       X
        1.3     HW      Yes             X       X
        1.3     SW      Yes             X       X
        1.4     HW      Yes             X       X
        1.4     SW      Yes             X       X
        1.5     HW      Yes             X       X
        1.5     SW      Yes             X       X
        1.6     HW      Yes             X       X
        1.6     SW      Yes             X       X
        1.7     HW      Yes             X       X
        1.7     SW      Yes             X       X
        1.8     HW      Yes             X       X
        1.8     SW      Yes             X       X

Graphics Devices:
        Name                                         Version             State
        VNC Mirror Driver                            1.8.0.0             Active
        Intel(R) HD Graphics 4600                    10.18.14.4332       Active
        NVIDIA GeForce GTX 970                       10.18.13.6191       08

System info:
        CPU:    Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
        OS:     Microsoft Windows 7 Ultimate
        Arch:   64 bits

Installed Media SDK packages (be patient...processing takes some time):
        Intel« Media SDK 2016

Installed Media SDK DirectShow filters:

Installed Intel Media Foundation Transforms:
  Intel« Hardware VC-1 Decoder MFT : {059A5BAE-5D7A-4C5E-8F7A-BFD57D1D6AAA}
  Intel« Hardware H.264 Decoder MFT : {45E5CE07-5AC7-4509-94E9-62DB27CF8F96}
  Intel« Hardware MPEG-2 Decoder MFT : {CD5BA7FF-9071-40E9-A462-8DC5152B1776}
  Intel« Quick Sync Video H.264 Encoder MFT : {4BE8D3C0-0515-4A37-AD55-E4BAE19AF471}
  Intel« Hardware Preprocessing MFT : {EE69B504-1CBF-4EA6-8137-BB10F806B014}



Analysis complete... [press ENTER]

Here is the report when iGPU is set as Windows extended screen (ID: 1) :

Intel Media SDK System Analyzer (32 bit)


The following versions of Media SDK API are supported by platform/driver:

        Version Target  Supported       Dec     Enc
        1.0     HW      Yes             X       X       [Adapter 1]
        1.0     SW      Yes             X       X
        1.1     HW      Yes             X       X       [Adapter 1]
        1.1     SW      Yes             X       X
        1.3     HW      Yes             X       X       [Adapter 1]
        1.3     SW      Yes             X       X
        1.4     HW      Yes             X       X       [Adapter 1]
        1.4     SW      Yes             X       X
        1.5     HW      Yes             X       X       [Adapter 1]
        1.5     SW      Yes             X       X
        1.6     HW      Yes             X       X       [Adapter 1]
        1.6     SW      Yes             X       X
        1.7     HW      Yes             X       X       [Adapter 1]
        1.7     SW      Yes             X       X
        1.8     HW      Yes             X       X       [Adapter 1]
        1.8     SW      Yes             X       X

Graphics Devices:
        Name                                         Version             State
        VNC Mirror Driver                            1.8.0.0             Active
        Intel(R) HD Graphics 4600                    10.18.14.4332       Active
        NVIDIA GeForce GTX 970                       10.18.13.6191       08

System info:
        CPU:    Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
        OS:     Microsoft Windows 7 Ultimate
        Arch:   64 bits

Installed Media SDK packages (be patient...processing takes some time):
        Intel« Media SDK 2016

Installed Media SDK DirectShow filters:

Installed Intel Media Foundation Transforms:
  Intel« Hardware VC-1 Decoder MFT : {059A5BAE-5D7A-4C5E-8F7A-BFD57D1D6AAA}
  Intel« Hardware H.264 Decoder MFT : {45E5CE07-5AC7-4509-94E9-62DB27CF8F96}
  Intel« Hardware MPEG-2 Decoder MFT : {CD5BA7FF-9071-40E9-A462-8DC5152B1776}
  Intel« Quick Sync Video H.264 Encoder MFT : {4BE8D3C0-0515-4A37-AD55-E4BAE19AF471}
  Intel« Hardware Preprocessing MFT : {EE69B504-1CBF-4EA6-8137-BB10F806B014}



Analysis complete... [press ENTER]

This means it's possible to detect the video adapter device ID that can create the Intel QSV HW encoding session.

Change History (0)

Note: See TracTickets for help on using tickets.