Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: VDPAU no longer used for some videos #2347

Closed
andreaskem opened this issue Sep 26, 2015 · 8 comments
Closed

Regression: VDPAU no longer used for some videos #2347

andreaskem opened this issue Sep 26, 2015 · 8 comments

Comments

@andreaskem
Copy link

Hi,

although I have had this problem for some time, I just now decided to look into it.

I am on an up-to-date Arch Linux system with the following software versions:
FFmpeg 2.8
Mesa 11.0, radeon driver r600
mpv 0.11.0 (+ current git master)

Some videos (H.264 in particular, not sure about other formats) that mpv played with VDPAU hardware decoding a few months ago are only played using software decoding now. Similar videos that should only differ in bit rate and resolution (I just noticed different profiles as well) are fine. I tested the options "--vo=opengl --hwdec=vdpau", "--vo=opengl-hq --hwdec=vdpau" and "--vo=vdpau --hwdec=vdpau" and there doesn't seem to be a difference in behavior.

ffprobe output for a problematic file:

Metadata:
  major_brand     : isom
  minor_version   : 512
  compatible_brands: isomiso2avc1mp41
  encoder         : Lavf56.15.102
Duration: 02:15:26.40, start: 0.000000, bitrate: 754 kb/s
  Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 596 kb/s, 59.94 fps, 59.94 tbr, 11988 tbn, 119.88 tbc (default)
  Metadata:
    handler_name    : VideoHandler
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 110 kb/s (default)
  Metadata:
    handler_name    : SoundHandler
  Stream #0:2(und): Data: none (rtp  / 0x20707472), 28 kb/s (default)
  Metadata:
    creation_time   : 2015-09-25 22:43:30
    handler_name    : GPAC ISO Hint Handler
  Stream #0:3(und): Data: none (rtp  / 0x20707472), 8 kb/s (default)
  Metadata:
    creation_time   : 2015-09-25 22:49:49
    handler_name    : GPAC ISO Hint Handler

ffprobe output for a non-problematic file:

Metadata:
  major_brand     : isom
  minor_version   : 512
  compatible_brands: isomiso2avc1mp41
  encoder         : Lavf56.15.102
Duration: 01:53:39.50, start: 0.000000, bitrate: 2041 kb/s
  Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 1802 kb/s, 59.94 fps, 59.94 tbr, 11988 tbn, 119.88 tbc (default)
  Metadata:
    handler_name    : VideoHandler
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
  Metadata:
    handler_name    : SoundHandler
  Stream #0:2(und): Data: none (rtp  / 0x20707472), 88 kb/s (default)
  Metadata:
    creation_time   : 2015-09-26 02:45:24
    handler_name    : GPAC ISO Hint Handler
  Stream #0:3(und): Data: none (rtp  / 0x20707472), 9 kb/s (default)
  Metadata:
    creation_time   : 2015-09-26 02:49:37
    handler_name    : GPAC ISO Hint Handler

I decided to do a git bisect and it blamed the following commit:

6f5a10542c276ad4fa87a2f449dc4173e10fc47d is the first bad commit
commit 6f5a10542c276ad4fa87a2f449dc4173e10fc47d
Author: wm4 <wm4@nowhere>
Date:   Thu May 28 21:56:13 2015 +0200

    vdpau: add support for the "new" libavcodec vdpau API

    Yet another of these dozens of hwaccel changes. This time, libavcodec
    provides utility functions, which initialize the vdpau decoder and map
    codec profiles. So a lot of work the API user had to do falls away.

    This also will give us support for high bit depth profiles, and possibly
    HEVC once libavcodec supports it.

On commit 0699a6c (the one before 6f5a105), everything is fine.

mpv output on 0699a6c:

 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=eng (*) (aac)
Using hardware decoding.
AO: [pulse] 48000Hz stereo 2ch float
VO: [opengl] 640x360 vdpau

mpv output on 6f5a105:

 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=eng (*) (aac)
Using hardware decoding.
AO: [pulse] 48000Hz stereo 2ch float
[ffmpeg/video] h264: get_buffer() failed
[ffmpeg/video] h264: thread_get_buffer() failed
[ffmpeg/video] h264: decode_slice_header error
[ffmpeg/video] h264: no frame!
Error while decoding frame!
Hardware decoding failed, falling back to software decoding.
VO: [opengl] 640x360 yuv420p

mpv output on v0.11.0:

 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=eng (*) (aac)
AO: [pulse] 48000Hz stereo 2ch float
Using software decoding.
VO: [opengl] 640x360 yuv420p

VLC correctly uses VDPAU hardware decoding for this file.

Best regards and thanks for your work on mpv,

Andreas

@ghost
Copy link

ghost commented Sep 26, 2015

VLC correctly uses VDPAU hardware decoding for this file.

Newer VLC also uses this API (I don't know if it's in any VLC release yet, maybe not), so it should show the same behavior.

Anyway, constrained baseline certainly should work if higher profiles are available. Maybe you can upload a sample file, so I don't have to generate one?

@andreaskem
Copy link
Author

youtube-dl -f600 "http://www.gamespot.com/videos/the-point-how-tony-hawk-turned-gamers-into-skaters/2300-6427248/"

This should give you a file that doesn't work on my setup.
VLC output for this file:

$ vlc The\ Point\ -\ How\ Tony\ Hawk\ Turned\ Gamers\ into\ Skaters-gs-2300-6427248.mp4 
VLC media player 2.2.1 Terry Pratchett (Weatherwax) (revision 2.2.1-0-ga425c42)
[00000000010bc158] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
"sni-qt/30525" WARN  14:23:48.119 void StatusNotifierItemFactory::connectToSnw() Invalid interface to SNW_SERVICE 
[00007ff874e7a438] avcodec decoder: Using G3DVL VDPAU Driver Shared Library version 1.0 for hardware decoding.

edit: Further, specifying -f1000 instead will select a format that works correctly on current git master. Although these are slightly different files, nothing changes with respect to the bug report above.

@Gusar321
Copy link
Contributor

It's probably a case of the driver not advertising constrained baseline support even though the hardware can handle it. Check with vdpauinfo. In this case, use --vd-lavc-check-hw-profile=no. I have some videos downloaded from Youtube (they're baseline profile) that by default aren't hardware decoded with vaapi, disabling profile checking does the trick.

@andreaskem
Copy link
Author

vdpauinfo output:

display: :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                           0  9216  2048  1152
MPEG2_SIMPLE                    3  9216  2048  1152
MPEG2_MAIN                      3  9216  2048  1152
H264_BASELINE                  41  9216  2048  1152
H264_MAIN                      41  9216  2048  1152
H264_HIGH                      41  9216  2048  1152
VC1_SIMPLE                     --- not supported ---
VC1_MAIN                       --- not supported ---
VC1_ADVANCED                    4  9216  2048  1152
MPEG4_PART2_SP                  3  9216  2048  1152
MPEG4_PART2_ASP                 5  9216  2048  1152
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      --- not supported ---
H264_EXTENDED                  --- not supported ---
H264_PROGRESSIVE_HIGH          --- not supported ---
H264_CONSTRAINED_HIGH          --- not supported ---
H264_HIGH_444_PREDICTIVE       --- not supported ---
HEVC_MAIN                      --- not supported ---
HEVC_MAIN_10                   --- not supported ---
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 A4I4 I4A4 A8I8 I8A8 
R8G8B8A8         16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 A8I8 I8A8 
R10G10B10A2      16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 A8I8 I8A8 
B10G10R10A2      16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 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                         -
HIGH QUALITY SCALING - L1        -
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     2048
VIDEO_SURFACE_HEIGHT             y        48     1152
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  

--vd-lavc-check-hw-profile=no does not help.

edit: "API version: 1" ? Is that a problem?

@Gusar321
Copy link
Contributor

Indeed, the driver lists constrained baseline as not supported. But --vd-lavc-check-hw-profile=no should have worked.

I'm using vaapi on Intel here, where the situation is exactly the opposite as yours, "constrained baseline" is supported, while "baseline" isn't. I downloaded that clip, it's hardware decoded by default here.

Pick any youtube format 18 video (youtube-dl -f18 https://www.youtube.com/watch?v=video_code_here), they're baseline profile. It's for those that I need to disable profile checking.

@ghost ghost added the down-upstream:ffmpeg label Sep 26, 2015
@ghost
Copy link

ghost commented Sep 26, 2015

This was a bug in the constrained baseline fallback in libavcodec. (But normally, the driver should report CBP as supported if it's supported, so it's the driver's fault too.) Patch is on libav-devel. This will actually be fixed as soon as that patch makes it in, and you use a libavcodec with the patch included.

--vd-lavc-check-hw-profile=no doesn't work with the new vdpau code.

@ghost ghost closed this as completed Sep 26, 2015
@andreaskem
Copy link
Author

Thank you very much.

I'd like to also get my driver fixed. Which project is responsible for exposing this profile? The radeon driver in mesa? Libvdpau, libdrm, something else entirely? Where should I complain?

@mc4man
Copy link

mc4man commented Sep 26, 2015

You have Radeon but there is a similar issue with nvidia-352, it has limited vdpau support for some reason.
Ex. on 352
Decoder capabilities:
MPEG1 0 65536 4032 4048
MPEG2_SIMPLE 3 65536 4032 4048
MPEG2_MAIN 3 65536 4032 4048
H264_BASELINE --- not supported ---
H264_MAIN 41 65536 4032 4080
H264_HIGH 41 65536 4032 4080
VC1_SIMPLE 1 8190 2048 2048
VC1_MAIN 2 8190 2048 2048
VC1_ADVANCED 4 8190 2048 2048
MPEG4_PART2_SP 3 8192 2048 2048
MPEG4_PART2_ASP 5 8192 2048 2048
DIVX4_QMOBILE 0 8192 2048 2048
DIVX4_MOBILE 0 8192 2048 2048
DIVX4_HOME_THEATER 0 8192 2048 2048
DIVX4_HD_1080P 0 8192 2048 2048
DIVX5_QMOBILE 0 8192 2048 2048
DIVX5_MOBILE 0 8192 2048 2048
DIVX5_HOME_THEATER 0 8192 2048 2048
DIVX5_HD_1080P 0 8192 2048 2048
H264_CONSTRAINED_BASELINE --- not supported ---
H264_EXTENDED --- not supported ---
H264_PROGRESSIVE_HIGH --- not supported ---
H264_CONSTRAINED_HIGH --- not supported ---
H264_HIGH_444_PREDICTIVE --- not supported ---
HEVC_MAIN --- not supported ---
HEVC_MAIN_10 --- not supported ---
HEVC_MAIN_STILL --- not supported ---
HEVC_MAIN_12 --- not supported ---
HEVC_MAIN_444 --- not supported ---

Where as nvidia-355 is more complete as far as h.264 & mpv will end up using vdpau decoding on your simple files
Ex. on 355
Decoder capabilities:
MPEG1 0 65536 4032 4048
MPEG2_SIMPLE 3 65536 4032 4048
MPEG2_MAIN 3 65536 4032 4048
H264_BASELINE 41 65536 4032 4080
H264_MAIN 41 65536 4032 4080
H264_HIGH 41 65536 4032 4080
VC1_SIMPLE 1 8190 2048 2048
VC1_MAIN 2 8190 2048 2048
VC1_ADVANCED 4 8190 2048 2048
MPEG4_PART2_SP 3 8192 2048 2048
MPEG4_PART2_ASP 5 8192 2048 2048
DIVX4_QMOBILE 0 8192 2048 2048
DIVX4_MOBILE 0 8192 2048 2048
DIVX4_HOME_THEATER 0 8192 2048 2048
DIVX4_HD_1080P 0 8192 2048 2048
DIVX5_QMOBILE 0 8192 2048 2048
DIVX5_MOBILE 0 8192 2048 2048
DIVX5_HOME_THEATER 0 8192 2048 2048
DIVX5_HD_1080P 0 8192 2048 2048
H264_CONSTRAINED_BASELINE 41 65536 4032 4080
H264_EXTENDED 41 65536 4032 4080
H264_PROGRESSIVE_HIGH 41 65536 4032 4080
H264_CONSTRAINED_HIGH 41 65536 4032 4080
H264_HIGH_444_PREDICTIVE 41 65536 4032 4080
HEVC_MAIN --- not supported ---
HEVC_MAIN_10 --- not supported ---
HEVC_MAIN_STILL --- not supported ---
HEVC_MAIN_12 --- not supported ---
HEVC_MAIN_444 --- not supported ---

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants