Opened 19 months ago

Last modified 11 months ago

#5286 new defect

ffmpeg -hwaccel vdpau limited to h264 level 4.1 since avconv_vdpau: use the hwcontext API to simplify code

Reported by: AndyF Owned by:
Priority: important Component: ffmpeg
Version: git-master Keywords: vdpau regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by cehoyos)

Summary of the bug:

Since

commit 6b706ce85fa56564986211b99d34e269066ca3d9
Merge: d779d8d bd49be8
Author: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Date:   Wed Feb 17 16:46:44 2016 +0000

    Merge commit 'bd49be885e9ad6bae599c54473ba2fa2957eb140'

    * commit 'bd49be885e9ad6bae599c54473ba2fa2Y957eb140':
      avconv_vdpau: use the hwcontext API to simplify code 

ffmpeg cli -hwaccel vdpau has reverted to honoring the h264 level as advertised by vdpau (41) and will use software decode rather than h/w

If I hack mesa so vdpau says 51 then 51 will work, 5.2 won't, I have to hack mesa to say 52 for 5.2 to work, yet AIUI vdpau spec doesn't even go as high as 5.2.

My AMD R9285 TONGA hardware is capable of decoding level 5.2 h264.

In addition the console output still mentions hardware decode and does not indicate falling back to software.

time ffmpeg -loglevel debug -hwaccel vdpau -i /mnt/sdb1/rawvid/concat/x264-2mix-2160p60-160M.mkv -f null -
ffmpeg version N-78893-gae76b84 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --prefix=/usr --disable-doc --enable-gpl --enable-libzimg --enable-libvpx --enable-libx265 --enable-libmp3lame --enable-libx264
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 27.101 / 57. 27.101
  libavformat    57. 27.102 / 57. 27.102
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 39.100 /  6. 39.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-hwaccel' ... matched as option 'hwaccel' (use HW accelerated decoding) with argument 'vdpau'.
Reading option '-i' ... matched as input file with argument '/mnt/sdb1/rawvid/concat/x264-2mix-2160p60-160M.mkv'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'null'.
Reading option '-' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file /mnt/sdb1/rawvid/concat/x264-2mix-2160p60-160M.mkv.
Applying option hwaccel (use HW accelerated decoding) with argument vdpau.
Successfully parsed a group of options.
Opening an input file: /mnt/sdb1/rawvid/concat/x264-2mix-2160p60-160M.mkv.
[file @ 0x2891820] Setting default whitelist 'file'
[matroska,webm @ 0x2891120] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
[matroska,webm @ 0x2891120] Before avformat_find_stream_info() pos: 641 bytes read:32768 seeks:0
[h264 @ 0x2893300] user data:"x264 - core 146 r2538 121396c - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:-1:-1 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.15 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-3 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=2pass mbtree=1 bitrate=160000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 cplxblur=20.0 qblur=0.5 ip_ratio=1.40 aq=1:1.00"
    Last message repeated 1 times
[h264 @ 0x2893300] no picture 
[matroska,webm @ 0x2891120] All info found
[matroska,webm @ 0x2891120] After avformat_find_stream_info() pos: 4549563 bytes read:4549563 seeks:0 frames:4
Input #0, matroska,webm, from '/mnt/sdb1/rawvid/concat/x264-2mix-2160p60-160M.mkv':
  Metadata:
    ENCODER         : Lavf56.40.101
  Duration: 00:00:16.67, start: 0.000000, bitrate: 161967 kb/s
    Stream #0:0, 4, 1/1000: Video: h264 (High), 5 reference frames, yuv420p(left), 3840x2160 [SAR 1:1 DAR 16:9], 1/120, 60 fps, 60 tbr, 1k tbn, 120 tbc (default)
    Metadata:
      ENCODER         : Lavc56.56.101 libx264
Successfully opened the file.
Parsing a group of options: output file -.
Applying option f (force format) with argument null.
Successfully parsed a group of options.
Opening an output file: -.
Successfully opened the file.
detected 4 logical cores
[graph 0 input from stream 0:0 @ 0x2894900] Setting 'video_size' to value '3840x2160'
[graph 0 input from stream 0:0 @ 0x2894900] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x2894900] Setting 'time_base' to value '1/1000'
[graph 0 input from stream 0:0 @ 0x2894900] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x2894900] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x2894900] Setting 'frame_rate' to value '60/1'
[graph 0 input from stream 0:0 @ 0x2894900] w:3840 h:2160 pixfmt:yuv420p tb:1/1000 fr:60/1 sar:1/1 sws_param:flags=2
[AVFilterGraph @ 0x36a9500] query_formats: 3 queried, 2 merged, 0 already done, 0 delayed
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf57.27.102
    Stream #0:0, 0, 1/60: Video: wrapped_avframe, 1 reference frame, yuv420p(left), 3840x2160 [SAR 1:1 DAR 16:9], 1/60, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc (default)
    Metadata:
      encoder         : Lavc57.27.101 wrapped_avframe
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[h264 @ 0x28969e0] user data:"x264 - core 146 r2538 121396c - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:-1:-1 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.15 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-3 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=2pass mbtree=1 bitrate=160000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 cplxblur=20.0 qblur=0.5 ip_ratio=1.40 aq=1:1.00"
Using VDPAU -- G3DVL VDPAU Driver Shared Library version 1.0 -- on X11 display :0.0, to decode input stream #0:0.
[h264 @ 0x28969e0] Hardware accelerated decoding with frame threading is known to be unstable and its use is discouraged.
[h264 @ 0x28969e0] no picture 
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x369d8a0] no picture 
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 3 times
[output stream 0:0 @ 0x2894780] EOF on sink link output stream 0:0:default.7x    
No more output streams to write to, finishing.
frame= 1000 fps= 41 q=-0.0 Lsize=N/A time=00:00:16.66 bitrate=N/A speed=0.68x    
video:477kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (/mnt/sdb1/rawvid/concat/x264-2mix-2160p60-160M.mkv):
  Input stream #0:0 (video): 1000 packets read (337430317 bytes); 1000 frames decoded; 
  Total: 1000 packets (337430317 bytes) demuxed
Output file #0 (pipe:):
  Output stream #0:0 (video): 1000 frames encoded; 1000 packets muxed (488000 bytes); 
  Total: 1000 packets (488000 bytes) muxed
1000 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x2899b80] Statistics: 337440018 bytes read, 0 seeks

real    0m24.768s
user    1m36.211s
sys     0m0.298s

Change History (8)

comment:1 Changed 19 months ago by cehoyos

  • Description modified (diff)
  • Keywords vdpau regression added
  • Priority changed from normal to important
  • Version changed from unspecified to git-master

comment:2 follow-up: Changed 19 months ago by heleppkes

When your driver reports wrong capabilities, you should report that to the driver developers.

comment:3 in reply to: ↑ 2 Changed 18 months ago by AndyF

Replying to heleppkes:

When your driver reports wrong capabilities, you should report that to the driver developers.

Sorry to be late gmail saw the notification as spam.

Debatable in the case that the vdpau specification in question doesn't actually go as high as the level needed for my h/w.

This is a regression - it was fixed previously to bring ffmpeg cli into line with what players already do = ignore vdpau level info as it's not really fit for purpose (I guess they use size or maybe bail on further errors?).

ffmpeg cli used to be reasonable = pragmatic in the face of a sub optimal standards situation to give users something working.

comment:4 Changed 16 months ago by michael

A patch that allows the user to force the profile to be ignored or otherwise to improve this is welcome, note send such patch to the ffmpeg-devel mailing list, it would likely be missed here

Last edited 16 months ago by michael (previous) (diff)

comment:6 Changed 16 months ago by AndyF

Thanks, I tested and that works for me.

Ironically in the past few days the level for my card did get raised, which I reverted to test.

Still useful for other radeon cards though, as they still get 4.1 when many will do 4.2.

One thing - it would be good if the fail case outputted an error saying falling back to s/w and giving the option needed to overide. Currently if it falls back to s/w due to level the output is a bit misleading as the last thing printed before fallback may be -

Hardware accelerated decoding with frame threading is known to be unstable and its use is discouraged.

comment:7 Changed 11 months ago by cehoyos

Is this still reproducible with current FFmpeg git head?

comment:8 Changed 11 months ago by AndyF

Yes, though as noted above I am not affected anymore, but I can fake having an older card via a mesa hack and have just tested like that.

Current ffmpeg behaves the same = silently falls back to s/w dec and prints a message which implies h/w dec is being used.

Note: See TracTickets for help on using tickets.