Opened 5 years ago

Closed 5 years ago

#7699 closed defect (fixed)

[regression] vaapi: Zero refs for a frame with P or B slices

Reported by: U. Artie Eoff Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: vaapi regression
Cc: sw@jkqxz.net, zhong.li@intel.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Since commit:

commit 362992e94bccca225d180e791f7e24858efb857d
Author: Mark Thompson <sw@jkqxz.net>
Date:   Thu Dec 20 20:39:59 2018 +0000

    vaapi_encode_h265: Support more complex reference structures
    
    The reference picture sets are now constructed directly from the DPB
    information.

Unable to decode HEVC 8-bit and 10-bit videos that were encoded by hevc_vaapi with g > 1 (GOP) and bf == 0 or bf == 1 or bf == 3 (B-frames) in any RC-mode (CQP, CBR, VBR).

This can be reproduced with both iHD and i965 intel drivers.

How to reproduce:

% ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 \
  -v verbose -f rawvideo -pix_fmt yuv420p -s:v 1920x1080 \
  -i input.yuv -vf 'format=nv12,hwupload' -c:v hevc_vaapi \
  -g 30 -qp 14 -bf 0 -vframes 10 -y output.h265

ffmpeg version N-93014-g362992e94bcc Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (GCC)
  configuration: --prefix=/home/uaeoff/Work/workspace/media/install --disable-static --enable-shared --enable-libdrm --enable-vaapi --enable-libmfx --disable-amf --disable-audiotoolbox --disable-cuda --disable-cuda-sdk --disable-cuvid --disable-d3d11va --disable-dxva2 --disable-libnpp --disable-mmal --disable-nvdec --disable-nvenc --disable-omx --disable-omx-rpi --disable-rkmpp --disable-v4l2-m2m --disable-vdpau --disable-videotoolbox
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 44.100 / 58. 44.100
  libavformat    58. 26.100 / 58. 26.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
[AVHWDeviceContext @ 0x1f01680] Opened VA display via DRM device /dev/dri/renderD128.
[AVHWDeviceContext @ 0x1f01680] libva: VA-API version 1.4.0
[AVHWDeviceContext @ 0x1f01680] libva: va_getDriverName() returns 0
[AVHWDeviceContext @ 0x1f01680] libva: Trying to open /home/uaeoff/Work/workspace/media/install/lib/dri/i965_drv_video.so
[AVHWDeviceContext @ 0x1f01680] libva: Found init function __vaDriverInit_1_4
[AVHWDeviceContext @ 0x1f01680] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x1f01680] Initialised VAAPI connection: version 1.4
[AVHWDeviceContext @ 0x1f01680] VAAPI driver: Intel i965 driver for Intel(R) Kaby Lake - 2.4.0.pre1 (2.4.0.pre1).
[AVHWDeviceContext @ 0x1f01680] Driver not found in known nonstandard list, using standard behaviour.
[rawvideo @ 0x1f123c0] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'input.yuv':
  Duration: 00:00:06.00, start: 0.000000, bitrate: 622080 kb/s
    Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 1920x1080, 622080 kb/s, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> hevc (hevc_vaapi))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x1f24480] w:1920 h:1080 pixfmt:yuv420p tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
[auto_scaler_0 @ 0x1f27980] w:iw h:ih flags:'bicubic' interl:0
[Parsed_format_0 @ 0x1f23b40] auto-inserting filter 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_format_0'
[auto_scaler_0 @ 0x1f27980] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:1920 h:1080 fmt:nv12 sar:0/1 flags:0x4
[hevc_vaapi @ 0x1f1fd40] Input surface format is nv12.
[hevc_vaapi @ 0x1f1fd40] Using VAAPI profile VAProfileHEVCMain (17).
[hevc_vaapi @ 0x1f1fd40] Using VAAPI entrypoint VAEntrypointEncSlice (6).
[hevc_vaapi @ 0x1f1fd40] Using VAAPI render target format YUV420 (0x1).
[hevc_vaapi @ 0x1f1fd40] Using constant-quality mode.
[hevc_vaapi @ 0x1f1fd40] Using intra and P-frames (supported references: 3 / 1).
[hevc_vaapi @ 0x1f1fd40] All wanted packed headers available (wanted 0xd, found 0x1f).
[hevc_vaapi @ 0x1f1fd40] Using level 4.
Output #0, hevc, to 'output.h265':
  Metadata:
    encoder         : Lavf58.26.100
    Stream #0:0: Video: hevc (hevc_vaapi) (Main), 1 reference frame, vaapi_vld, 1920x1080, q=-1--1, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.44.100 hevc_vaapi
No more output streams to write to, finishing.
frame=   10 fps=0.0 q=-0.0 Lsize=    1261kB time=00:00:00.40 bitrate=25818.6kbits/s speed=3.53x    
video:1261kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Input file #0 (input.yuv):
  Input stream #0:0 (video): 10 packets read (31104000 bytes); 10 frames decoded; 
  Total: 10 packets (31104000 bytes) demuxed
Output file #0 (output.h265):
  Output stream #0:0 (video): 10 frames encoded; 10 packets muxed (1290930 bytes); 
  Total: 10 packets (1290930 bytes) muxed
[AVIOContext @ 0x1f20b40] Statistics: 0 seeks, 5 writeouts
[AVIOContext @ 0x1f1b600] Statistics: 31104000 bytes read, 0 seeks


% ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 \
  -v verbose -i output.h265 -pix_fmt yuv420p -f rawvideo \
  -vsync passthrough -vframes 10 -y output.yuv

ffmpeg version N-93014-g362992e94bcc Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (GCC)
  configuration: --prefix=/home/uaeoff/Work/workspace/media/install --disable-static --enable-shared --enable-libdrm --enable-vaapi --enable-libmfx --disable-amf --disable-audiotoolbox --disable-cuda --disable-cuda-sdk --disable-cuvid --disable-d3d11va --disable-dxva2 --disable-libnpp --disable-mmal --disable-nvdec --disable-nvenc --disable-omx --disable-omx-rpi --disable-rkmpp --disable-v4l2-m2m --disable-vdpau --disable-videotoolbox
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 44.100 / 58. 44.100
  libavformat    58. 26.100 / 58. 26.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
[AVHWDeviceContext @ 0x9e0500] Opened VA display via DRM device /dev/dri/renderD128.
[AVHWDeviceContext @ 0x9e0500] libva: VA-API version 1.4.0
[AVHWDeviceContext @ 0x9e0500] libva: va_getDriverName() returns 0
[AVHWDeviceContext @ 0x9e0500] libva: Trying to open /home/uaeoff/Work/workspace/media/install/lib/dri/i965_drv_video.so
[AVHWDeviceContext @ 0x9e0500] libva: Found init function __vaDriverInit_1_4
[AVHWDeviceContext @ 0x9e0500] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x9e0500] Initialised VAAPI connection: version 1.4
[AVHWDeviceContext @ 0x9e0500] VAAPI driver: Intel i965 driver for Intel(R) Kaby Lake - 2.4.0.pre1 (2.4.0.pre1).
[AVHWDeviceContext @ 0x9e0500] Driver not found in known nonstandard list, using standard behaviour.
Input #0, hevc, from 'output.h265':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: hevc (Main), 1 reference frame, yuv420p(tv), 1920x1080 (1920x1088), 25 fps, 25 tbr, 1200k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[hevc @ 0xa3e100] Zero refs for a frame with P or B slices.
[hevc @ 0xa3e100] Error parsing NAL unit #0.
[hevc @ 0xa5fcc0] Zero refs for a frame with P or B slices.
[hevc @ 0xa5fcc0] Error parsing NAL unit #0.
[hevc @ 0xa15400] Zero refs for a frame with P or B slices.
[hevc @ 0xa15400] Error parsing NAL unit #0.
[hevc @ 0xa25880] Zero refs for a frame with P or B slices.
[hevc @ 0xa25880] Error parsing NAL unit #0.
[hevc @ 0xa2e540] Zero refs for a frame with P or B slices.
[hevc @ 0xa2e540] Error parsing NAL unit #0.
[hevc @ 0xacb1c0] Zero refs for a frame with P or B slices.
[hevc @ 0xacb1c0] Error parsing NAL unit #0.
[hevc @ 0xadb8c0] Zero refs for a frame with P or B slices.
[hevc @ 0xadb8c0] Error parsing NAL unit #0.
[hevc @ 0xaec100] Zero refs for a frame with P or B slices.
[hevc @ 0xaec100] Error parsing NAL unit #0.
[graph 0 input from stream 0:0 @ 0x1560bc0] w:1920 h:1080 pixfmt:nv12 tb:1/1200000 fr:25/1 sar:0/1 sws_param:flags=2
[auto_scaler_0 @ 0x1563100] w:iw h:ih flags:'bicubic' interl:0
[format @ 0x1561440] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format'
[auto_scaler_0 @ 0x1563100] w:1920 h:1080 fmt:nv12 sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x4
Output #0, rawvideo, to 'output.yuv':
  Metadata:
    encoder         : Lavf58.26.100
    Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 1920x1080, q=2-31, 622080 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.44.100 rawvideo
Error while decoding stream #0:0: Invalid data found when processing input
[hevc @ 0x9f4000] Zero refs for a frame with P or B slices.
[hevc @ 0x9f4000] Error parsing NAL unit #0.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 7 times
No more output streams to write to, finishing.
frame=    1 fps=0.0 q=-0.0 Lsize=    3038kB time=00:00:00.04 bitrate=622080.0kbits/s speed=1.57x    
video:3038kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Input file #0 (output.h265):
  Input stream #0:0 (video): 10 packets read (1290930 bytes); 1 frames decoded; 
  Total: 10 packets (1290930 bytes) demuxed
Output file #0 (output.yuv):
  Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (3110400 bytes); 
  Total: 1 packets (3110400 bytes) muxed
[AVIOContext @ 0x9f7f40] Statistics: 0 seeks, 12 writeouts
[AVIOContext @ 0x9fa180] Statistics: 1290930 bytes read, 0 seeks
Conversion failed!

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (2)

comment:1 by Carl Eugen Hoyos, 5 years ago

Keywords: regression added; hevc h265 removed
Priority: normalimportant

comment:2 by Carl Eugen Hoyos, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.