UltraStar-Deluxe / USDX

The free and open source karaoke singing game UltraStar Deluxe, inspired by Sony SingStar™
https://usdx.eu
GNU General Public License v2.0
829 stars 160 forks source link

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

Open Rom888 opened 3 years ago

Rom888 commented 3 years ago

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

s09bQ5 commented 3 years ago

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.

Rom888 commented 3 years ago

@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)
s09bQ5 commented 3 years ago

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.