[FFmpeg-user] OpenVPL-cpu and ffmpeg's qsv encoder

Ferdi Scholten ferdi at sttc-nlp.nl
Mon Oct 14 17:25:07 EEST 2024


Hello all!
> I was trying to debug my _qsv profiles for Cinelerra-GG (of course) and was
> hitting wall due to my machine being AMD CPU/Nvidia (nouveau) GPU.
>
> Then I foundhttps://github.com/oneapi-src/oneVPL-cpu/blob/master/INSTALL.md
>
> Deprecated by intel but still buildable after some fighting.
>
> bash-5.1$ vpl-inspect
>
> Implementation #0: oneAPI VPL CPU Implementation
>    Library path: /usr/local/lib/libvplswref32.so.1
>    AccelerationMode: MFX_ACCEL_MODE_NA
>    ApiVersion: 2.13
>    Impl: MFX_IMPL_TYPE_SOFTWARE
>    VendorImplID: 0x0000
>    ImplName: oneAPI VPL CPU Implementation
>    License: MIT
>    Version: 1.2
>    Keywords: VPL,CPU,x64
>    VendorID: 0x8086
>    mfxAccelerationModeDescription:
>      Version: 1.0
>      Mode: MFX_ACCEL_MODE_NA
>    mfxPoolPolicyDescription:
>      Version: 1.0
>      Policy: MFX_ALLOCATION_UNLIMITED
>    mfxDeviceDescription:
>      MediaAdapterType: MFX_MEDIA_UNKNOWN
>      DeviceID: 0000
>      Version: 1.1
>    mfxDecoderDescription:
>      Version: 1.0
>      CodecID: AV1
>      MaxcodecLevel: 53
>        Profile: MFX_PROFILE_AV1_MAIN
>          MemHandleType: MFX_RESOURCE_SYSTEM_SURFACE
>            Width Min: 64
>            Width Max: 4096
>            Width Step: 8
>            Height Min: 64
>            Height Max: 4096
>            Height Step: 8
>            ColorFormats: IYUV, I010
>      CodecID: AVC
>      MaxcodecLevel: 52
>        Profile: MFX_PROFILE_AVC_HIGH
>          MemHandleType: MFX_RESOURCE_SYSTEM_SURFACE
>            Width Min: 64
>            Width Max: 4096
>            Width Step: 8
>            Height Min: 64
>            Height Max: 4096
>            Height Step: 8
>            ColorFormats: IYUV
>      CodecID: HEVC
>      MaxcodecLevel: 51
>        Profile: MFX_PROFILE_HEVC_MAIN
>          MemHandleType: MFX_RESOURCE_SYSTEM_SURFACE
>            Width Min: 64
>            Width Max: 4096
>            Width Step: 8
>            Height Min: 64
>            Height Max: 4096
>            Height Step: 8
>            ColorFormats: IYUV
>        Profile: MFX_PROFILE_HEVC_MAIN10
>          MemHandleType: MFX_RESOURCE_SYSTEM_SURFACE
>            Width Min: 64
>            Width Max: 4096
>            Width Step: 8
>            Height Min: 64
>            Height Max: 4096
>            Height Step: 8
>            ColorFormats: I010
>      CodecID: JPEG
>      MaxcodecLevel: 0
>        Profile: MFX_PROFILE_JPEG_BASELINE
>          MemHandleType: MFX_RESOURCE_SYSTEM_SURFACE
>            Width Min: 64
>            Width Max: 4096
>            Width Step: 8
>            Height Min: 64
>            Height Max: 4096
>            Height Step: 8
>            ColorFormats: IYUV
>      CodecID: MPG2
>      MaxcodecLevel: 8
>        Profile: MFX_PROFILE_MPEG2_MAIN
>          MemHandleType: MFX_RESOURCE_SYSTEM_SURFACE
>            Width Min: 64
>            Width Max: 4096
>            Width Step: 8
>            Height Min: 64
>            Height Max: 4096
>            Height Step: 8
>            ColorFormats: IYUV
>    mfxEncoderDescription:
>      Version: 1.0
>      CodecID: AV1
>      MaxcodecLevel: 53
>      BiDirectionalPrediction: 1
>      ReportedStats: 0
>        Profile: MFX_PROFILE_AV1_MAIN
>          MemHandleType: MFX_RESOURCE_SYSTEM_SURFACE
>            Width Min: 64
>            Width Max: 4096
>            Width Step: 8
>            Height Min: 64
>            Height Max: 4096
>            Height Step: 8
>            ColorFormats: IYUV, I010
>      CodecID: HEVC
>      MaxcodecLevel: 51
>      BiDirectionalPrediction: 1
>      ReportedStats: 0
>        Profile: MFX_PROFILE_HEVC_MAIN
>          MemHandleType: MFX_RESOURCE_SYSTEM_SURFACE
>            Width Min: 64
>            Width Max: 4096
>            Width Step: 8
>            Height Min: 64
>            Height Max: 4096
>            Height Step: 8
>            ColorFormats: IYUV
>        Profile: MFX_PROFILE_HEVC_MAIN10
>          MemHandleType: MFX_RESOURCE_SYSTEM_SURFACE
>            Width Min: 64
>            Width Max: 4096
>            Width Step: 8
>            Height Min: 64
>            Height Max: 4096
>            Height Step: 8
>            ColorFormats: I010
>      CodecID: JPEG
>      MaxcodecLevel: 0
>      BiDirectionalPrediction: 0
>      ReportedStats: 0
>        Profile: MFX_PROFILE_JPEG_BASELINE
>          MemHandleType: MFX_RESOURCE_SYSTEM_SURFACE
>            Width Min: 64
>            Width Max: 4096
>            Width Step: 8
>            Height Min: 64
>            Height Max: 4096
>            Height Step: 8
>            ColorFormats: IYUV
>    mfxVPPDescription:
>      Version: 1.0
>      FilterFourCC: VCSC
>      MaxDelayInFrames: 1
>        MemHandleType: MFX_RESOURCE_SYSTEM_SURFACE
>        Width Min: 64
>        Width Max: 4096
>        Width Step: 8
>        Height Min: 64
>        Height Max: 4096
>        Height Step: 8
>          InFormat: I010
>            OutFormats: IYUV, RGB4
>          InFormat: IYUV
>            OutFormats: I010, RGB4
>          InFormat: RGB4
>            OutFormats: IYUV, I010
>      FilterFourCC: VSCL
>      MaxDelayInFrames: 1
>        MemHandleType: MFX_RESOURCE_SYSTEM_SURFACE
>        Width Min: 64
>        Width Max: 4096
>        Width Step: 8
>        Height Min: 64
>        Height Max: 4096
>        Height Step: 8
>          InFormat: I010
>            OutFormats: I010
>          InFormat: IYUV
>            OutFormats: IYUV
>          InFormat: RGB4
>            OutFormats: RGB4
>    NumExtParam: 0
>
> Total number of implementations found = 1
>
> But ffmpeg still does not work:
>
> bash-5.1$ ./ffmpeg/ffmpeg -i mc.avi -c:v mjpeg_qsv -f null /dev/null
> ffmpeg version N-116241-g9bc1678934 Copyright (c) 2000-2024 the FFmpeg
> developers
>    built with gcc 11.2.0 (GCC)
>    configuration: --enable-libvpl
>    libavutil      59. 41.100 / 59. 41.100
>    libavcodec     61. 21.100 / 61. 21.100
>    libavformat    61.  9.100 / 61.  9.100
>    libavdevice    61.  4.100 / 61.  4.100
>    libavfilter    10.  6.100 / 10.  6.100
>    libswscale      8.  4.100 /  8.  4.100
>    libswresample   5.  4.100 /  5.  4.100
> [aist#0:1/pcm_u8 @ 0xb39c2c0] Guessed Channel Layout: mono
> Input #0, avi, from 'mc.avi':
>    Metadata:
>      software        : MEncoder SVN-r38660-11.2.0
>    Duration: 00:00:28.29, start: 0.000000, bitrate: 3259 kb/s
>    Stream #0:0: Video: mjpeg (Baseline) (mjpg / 0x67706A6D), yuvj422p(pc,
> bt470bg/unknown/unknown), 320x240, 3205 kn
>    Stream #0:1: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 7812 Hz, mono, u8, 62
> kb/s
> Stream mapping:
>    Stream #0:0 -> #0:0 (mjpeg (native) -> mjpeg (mjpeg_qsv))
>    Stream #0:1 -> #0:1 (pcm_u8 (native) -> pcm_s16le (native))
> Press [q] to stop, [?] for help
> [swscaler @ 0xf4c0e2c0] deprecated pixel format used, make sure you did set
> range correctly
> [mjpeg_qsv @ 0xb3a7040] Error creating a MFX session: -9.
> [vost#0:0/mjpeg_qsv @ 0xb3a6b40] [enc:mjpeg_qsv @ 0xb3a6f80] Error while
> opening encoder - maybe incorrect paramet.
> [vf#0:0 @ 0xb3a7d40] Error sending frames to consumers: Unknown error
> occurred
> [vf#0:0 @ 0xb3a7d40] Task finished with error code: -1313558101 (Unknown
> error occurred)
> [vost#0:0/mjpeg_qsv @ 0xb3a6b40] [enc:mjpeg_qsv @ 0xb3a6f80] Could not open
> encoder before EOF
> [vost#0:0/mjpeg_qsv @ 0xb3a6b40] Task finished with error code: -22
> (Invalid argument)
> [vost#0:0/mjpeg_qsv @ 0xb3a6b40] Terminating thread with return code -22
> (Invalid argument)
> [vf#0:0 @ 0xb3a7d40] Terminating thread with return code -1313558101
> (Unknown error occurred)
> [out#0/null @ 0xb39cb40] Nothing was written into output file, because at
> least one of its streams received no pac.
> frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A
> Conversion failed!
>
> I tried to look at sourcecode, but changing obvious places in
> libavutil/hwcontext_qsv.c to sw implementation changed nothing, and
>
> Error creating a MFX session: -9
>
> was coming from libavcodec/qsv.c (I changed printed message a bit)
>
> decoder also does not work
>
> Any ideas how to convince ffmpeg to use this OneVPL implementation?
> _______________________________________________

> Perhaps stating the obvious: You can use the software, but in order for it to work properly it needs the hardware it was written for.


More information about the ffmpeg-user mailing list