You are not logged in.

#1 2018-08-21 16:53:22

Sovneer
Member
Registered: 2018-08-21
Posts: 4

Hardware acceleration and streams

Hello, archusers.
I'm trying to make hardware acceleration work with streams. On this wiki page i found a lot usefull about acceleration. I installed necessary packages. Acceleration works perfectly with any video on youtube or other video hosting... except streams. For example,

mpv some_twitch_stream
Playing: some_twitch_stream
 (+) Video --vid=1 (h264 1280x720)
 (+) Audio --aid=1 (aac 2ch 44100Hz)

AO: [pulse] 44100Hz stereo 2ch float
VO: [gpu] 1280x720 yuv420p
AV: 00:00:57 / 00:01:01 (92%) A-V:  0.000 Dropped: 14 Cache:  4s+2MB

Here you can see that there is no message about acceleration. Cpu usage is quite high (~30%).
I tested about 20 different streams and did't get a point what is the problem.

Some useful information:

lspci -knn | grep -A3 VGA
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X] [1002:67df] (rev c7)
	Subsystem: Micro-Star International Co., Ltd. [MSI] Radeon RX 480 [1462:3413]
	Kernel driver in use: amdgpu
	Kernel modules: amdgpu

vdpauinfo 
display: :0.0   screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0

Video surface:

name   width height types
-------------------------------------------
420    16384 16384  NV12 YV12 
422    16384 16384  UYVY YUYV 
444    16384 16384  Y8U8V8A8 V8U8Y8A8 

Decoder capabilities:

name                        level macbs width height
----------------------------------------------------
MPEG1                          --- not supported ---
MPEG2_SIMPLE                    3 65536  4096  4096
MPEG2_MAIN                      3 65536  4096  4096
H264_BASELINE                  52 65536  4096  4096
H264_MAIN                      52 65536  4096  4096
H264_HIGH                      52 65536  4096  4096
VC1_SIMPLE                      1 65536  4096  4096
VC1_MAIN                        2 65536  4096  4096
VC1_ADVANCED                    4 65536  4096  4096
MPEG4_PART2_SP                  3 65536  4096  4096
MPEG4_PART2_ASP                 5 65536  4096  4096
DIVX4_QMOBILE                  --- not supported ---
DIVX4_MOBILE                   --- not supported ---
DIVX4_HOME_THEATER             --- not supported ---
DIVX4_HD_1080P                 --- not supported ---
DIVX5_QMOBILE                  --- not supported ---
DIVX5_MOBILE                   --- not supported ---
DIVX5_HOME_THEATER             --- not supported ---
DIVX5_HD_1080P                 --- not supported ---
H264_CONSTRAINED_BASELINE       0 65536  4096  4096
H264_EXTENDED                  --- not supported ---
H264_PROGRESSIVE_HIGH          --- not supported ---
H264_CONSTRAINED_HIGH          --- not supported ---
H264_HIGH_444_PREDICTIVE       --- not supported ---
HEVC_MAIN                      186 65536  4096  4096
HEVC_MAIN_10                   186 65536  4096  4096
HEVC_MAIN_STILL                --- not supported ---
HEVC_MAIN_12                   --- not supported ---
HEVC_MAIN_444                  --- not supported ---

Output surface:

name              width height nat types
----------------------------------------------------
B8G8R8A8         16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A8I8 I8A8 
R8G8B8A8         16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A8I8 I8A8 
R10G10B10A2      16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A8I8 I8A8 
B10G10R10A2      16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A8I8 I8A8 

Bitmap surface:

name              width height
------------------------------
B8G8R8A8         16384 16384
R8G8B8A8         16384 16384
R10G10B10A2      16384 16384
B10G10R10A2      16384 16384
A8               16384 16384

Video mixer:

feature name                    sup
------------------------------------
DEINTERLACE_TEMPORAL             y
DEINTERLACE_TEMPORAL_SPATIAL     -
INVERSE_TELECINE                 -
NOISE_REDUCTION                  y
SHARPNESS                        y
LUMA_KEY                         y
HIGH QUALITY SCALING - L1        y
HIGH QUALITY SCALING - L2        -
HIGH QUALITY SCALING - L3        -
HIGH QUALITY SCALING - L4        -
HIGH QUALITY SCALING - L5        -
HIGH QUALITY SCALING - L6        -
HIGH QUALITY SCALING - L7        -
HIGH QUALITY SCALING - L8        -
HIGH QUALITY SCALING - L9        -

parameter name                  sup      min      max
-----------------------------------------------------
VIDEO_SURFACE_WIDTH              y        48     4096
VIDEO_SURFACE_HEIGHT             y        48     4096
CHROMA_TYPE                      y  
LAYERS                           y         0        4

attribute name                  sup      min      max
-----------------------------------------------------
BACKGROUND_COLOR                 y  
CSC_MATRIX                       y  
NOISE_REDUCTION_LEVEL            y      0.00     1.00
SHARPNESS_LEVEL                  y     -1.00     1.00
LUMA_KEY_MIN_LUMA                y  
LUMA_KEY_MAX_LUMA                y 

cat .config/mpv/mpv.conf
hwdec=vdpau
cache=yes
cache-secs=600

Any help is appreciated.

Last edited by Sovneer (2018-08-21 16:54:12)

Offline

#2 2018-08-21 18:24:53

frumble
Member
From: Germany
Registered: 2012-05-20
Posts: 162
Website

Re: Hardware acceleration and streams

So, you have a Radeon RX400/500 series. Does video acceleration work with local files? Please post your mpv.conf.
If you don’t have any: Try this.
You will also need mpv-git from AUR for the time being. You can display rendering informations in a HUD too with shortcut "i".
Edit: Sorry, didn’t read that it works with other hosted video platforms. But maybe, just try my config in the link above, I do get VA-API rendering with it on Twitch, also with a RX580.

Last edited by frumble (2018-08-21 18:29:54)

Offline

#3 2018-08-22 04:08:50

Sovneer
Member
Registered: 2018-08-21
Posts: 4

Re: Hardware acceleration and streams

frumble wrote:

Edit: Sorry, didn’t read that it works with other hosted video platforms. But maybe, just try my config in the link above, I do get VA-API rendering with it on Twitch, also with a RX580.

Thanks for your reply.  Unfortunately vaapi doesn't solve the problem.

vainfo: VA-API version: 1.2 (libva 2.2.0)
vainfo: Driver version: Mesa Gallium driver 18.1.6 for AMD Radeon (TM) RX 480 Graphics (POLARIS10, DRM 3.26.0, 4.18.3-arch1-1-ARCH, LLVM 6.0.1)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc
cat .config/mpv/mpv.conf
hwdec=vaapi
cache=yes
cache-secs=600
mpv random_twitch_stream
Playing: random_twitch_stream
 (+) Video --vid=1 (h264 1920x1080)
 (+) Audio --aid=1 (aac 2ch 48000Hz)

AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p
AV: 00:00:13 / 00:00:19 (67%) A-V:  0.000 Cache:  6s+4MB

Last edited by Sovneer (2018-08-22 04:09:47)

Offline

#4 2018-08-22 11:11:26

frumble
Member
From: Germany
Registered: 2012-05-20
Posts: 162
Website

Re: Hardware acceleration and streams

Did you try gpu-context=x11egl and mpv-git?
libva-mesa-driver is installed?

Offline

#5 2018-08-22 16:39:13

Sovneer
Member
Registered: 2018-08-21
Posts: 4

Re: Hardware acceleration and streams

I tried gpu-context=x11egl, but it didn't help either with vaapi or vdpau.
Actualy i prefer not to use aur packages.

Offline

#6 2018-08-22 18:00:28

frumble
Member
From: Germany
Registered: 2012-05-20
Posts: 162
Website

Re: Hardware acceleration and streams

Does VA-API acceleration work with mpv with other files? Forget VDPAU, it’s deprecated and causes lots of problems.
You might actually still need a prerelease version of mpv and its ffmpeg dependency. You can always roll back to the repo packages.

Last edited by frumble (2018-08-22 18:01:08)

Offline

#7 2018-08-22 18:15:12

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: Hardware acceleration and streams

-git versions aren't needed anymore, released versions already have everything. mpv needs the --hwdec=vaapi --gpu-context=x11egl options (both are needed, mpv's vaapi support doesn't work with the default gpu context). If that doesn't work, post a full mpv log that can be created by using --log-file=mpv_log.txt. Could be mpv fails to decode the first few frames of the stream for whatever reason and therefore switches to software decoding as fallback.

Offline

#8 2018-08-22 18:45:53

Sovneer
Member
Registered: 2018-08-21
Posts: 4

Re: Hardware acceleration and streams

It's ok now after rebooting. With vaapi and x11egl i get hardware decoding. Thank you.
Anyway cpu load is still quite high.
Here's cpu load when mpv plays random youtube video:

mpv video
Playing: video
 (+) Video --vid=1 (*) (h264 1280x720 24.000fps)
 (+) Audio --aid=1 --alang=eng (*) 'DASH audio' (opus 2ch 48000Hz) (external)
AO: [pulse] 48000Hz stereo 2ch float
Using hardware decoding (vaapi).
VO: [gpu] 1280x720 vaapi[nv12]
AV: 00:00:19 / 00:59:24 (0%) A-V:  0.000 Cache: 46s+3MB

mpstat 1 5
Linux 4.18.3-arch1-1-ARCH    08/22/2018 	_x86_64_	(4 CPU)

09:33:48 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
09:33:49 PM  all    2.80    0.00    2.04    0.00    0.25    0.25    0.00    0.00    0.00   94.66
09:33:50 PM  all    2.27    0.00    2.53    0.00    0.25    0.00    0.00    0.00    0.00   94.95
09:33:51 PM  all    2.30    0.00    3.57    0.00    0.51    0.51    0.00    0.00    0.00   93.11
09:33:52 PM  all    3.27    0.00    2.51    0.00    0.50    0.00    0.00    0.00    0.00   93.72
09:33:53 PM  all    1.79    0.00    2.56    0.00    0.26    0.51    0.00    0.00    0.00   94.87
Average:     all    2.49    0.00    2.64    0.00    0.36    0.25    0.00    0.00    0.00   94.26

And here's cpu load when mpv plays random twitch stream:

mpv stream
Playing: stream
 (+) Video --vid=1 (h264 1280x720)
 (+) Audio --aid=1 (aac 2ch 48000Hz)
Using hardware decoding (vaapi).
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1280x720 vaapi[nv12]
AV: 00:00:27 / 00:00:33 (82%) A-V:  0.000 Cache:  5s+2MB

mpstat 1 5
Linux 4.18.3-arch1-1-ARCH    08/22/2018 	_x86_64_	(4 CPU)

09:37:14 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
09:37:15 PM  all   14.57    0.00    8.04    0.00    0.50    1.26    0.00    0.00    0.00   75.63
09:37:16 PM  all   10.05    0.00    4.02    0.00    0.50    0.00    0.00    0.00    0.00   85.43
09:37:17 PM  all   14.93    0.00    4.48    0.00    0.25    0.25    0.00    0.00    0.00   80.10
09:37:18 PM  all   14.29    0.00    3.51    0.00    0.25    0.00    0.00    0.00    0.00   81.95
09:37:19 PM  all   13.11    0.00    3.60    0.00    0.77    0.00    0.00    0.00    0.00   82.52
Average:     all   13.39    0.00    4.73    0.00    0.45    0.30    0.00    0.00    0.00   81.12
 

I have no idea if this is normal cpu load while watching stream.
Mpv log: https://pastebin.com/ts3mNtuN

Offline

Board footer

Powered by FluxBB