USDX icon indicating copy to clipboard operation
USDX copied to clipboard

How to enable VAAPI? (ffmpeg --enable-vaapi ?)

Open Rom888 opened this issue 3 years ago • 3 comments

I tried to enable VAAPI (hardware-accelerated codec) on my ubuntu 20.04 focal because MPV can use it on my PC. This was added to config.ini as @cRaZy-bisCuiT suggested:

[Graphics]
PreferredCodecs=vaapi

I think I need to build ffmpeg with --enable-vaapi option. Where should I put it before building USDX?

At the moment I have this error in the Error.log:

ERROR:  Unknown preferred codec vaapi [TVideo_FFmpeg]
INFO:   Valid non-default codecs are: [TVideo_FFmpeg]
INFO:       h263_v4l2m2m [H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2]
INFO:       h264_v4l2m2m [H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]
INFO:       hevc_v4l2m2m [H.265 / HEVC (High Efficiency Video Coding)]
INFO:       mpeg4_v4l2m2m [MPEG-4 part 2]
INFO:       mpegvideo [MPEG-2 video]
INFO:       mpeg1_v4l2m2m [MPEG-1 video]
INFO:       mpeg2_v4l2m2m [MPEG-2 video]
INFO:       vc1_v4l2m2m [SMPTE VC-1]
INFO:       vp8_v4l2m2m [On2 VP8]
INFO:       vp9_v4l2m2m [Google VP9]
INFO:       libopenjpeg [JPEG 2000]
INFO:       libvpx [On2 VP8]
INFO:       libvpx-vp9 [Google VP9]
INFO:       h264_cuvid [H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]
INFO:       hevc_cuvid [H.265 / HEVC (High Efficiency Video Coding)]
INFO:       mjpeg_cuvid [Motion JPEG]
INFO:       mpeg1_cuvid [MPEG-1 video]
INFO:       mpeg2_cuvid [MPEG-2 video]
INFO:       mpeg4_cuvid [MPEG-4 part 2]
INFO:       vc1_cuvid [SMPTE VC-1]
INFO:       vp8_cuvid [On2 VP8]
INFO:       vp9_cuvid [Google VP9]
INFO:   VideoStreamIndex : -1 [TVideoPlayback_ffmpeg.Open]
INFO:   Using h264 codec [TVideoPlayback_ffmpeg.Open]
INFO:   Framerate: 24fps [TVideoPlayback_ffmpeg.Open]
INFO:   Using decoder FFmpeg_Decoder for "/home..." [TAudioPlaybackBase.OpenDecodeStream]

@andy5995

Rom888 avatar Dec 10 '20 17:12 Rom888

Sorry, VAAPI is not supported. Supporting the Raspberry Pi decoder hardware was easy because it behaves like a normal software codec that renders an RGB image into RAM. But with VAAPI we have to use a different API in FFmpeg to get an RGB image and the most efficient way to render the image would be to skip that conversion step and instead use a special libva function to let the GPU copy the image into an OpenGL texture.

s09bQ5 avatar Dec 10 '20 20:12 s09bQ5

@s09bQ5 thanks for reply, Do you think there is any other way to switch on hardware decoding for Intel Graphics Controllers with USDX on Ubuntu 20.04 focal?

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)

Rom888 avatar Dec 11 '20 06:12 Rom888

The only way is to sit down, make oneself familiar with the FFmpeg API for hardware acceleration, and change the source code of USDX to use it.

s09bQ5 avatar Dec 11 '20 08:12 s09bQ5