Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#8341 closed defect (fixed)

FFmpeg-VAAPI VP8/VP9 encoder generates Zero byte in output

Reported by: Linjie.Fu Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: vaapi encode
Cc: linjie.fu@intel.com Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

System Environment
=======
Previously reproduced:
Platform: KBL/ICL
Arch: x86_64
Kernel: 5.0.0
Libva: c98b06d2b8c00dc4df628488b672711b3f0eb118
iHD_driver: 5366de39a3f3b7f256b540bfa0ba088133315610
libva-utils: 375e4eaae3377c1806e83874f9fa9b79b1f225b1
ffmpeg: latest mainline ffmpeg

And it still could be reproduced with the latest version of media-driver/ffmpeg/...

Reproduce Steps
==============

It could be reproduced with a random yuv input file.

And the output has Zero byte.

ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -v verbose -f rawvideo -pix_fmt yuv420p -s:v 1280x720 -i ./720p_I420_1.yuv -vf 'format=nv12,hwupload' -c:v vp8_vaapi -y out.ivf
ffmpeg version N-95535-g9ae3b08aab Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --enable-libmfx --disable-optimizations --enable-debug=3 --disable-stripping --enable-gpl --enable-libopenh264 --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      56. 35.101 / 56. 35.101
  libavcodec     58. 59.102 / 58. 59.102
  libavformat    58. 33.100 / 58. 33.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 64.100 /  7. 64.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[AVHWDeviceContext @ 0x55ea8f484f80] libva: VA-API version 1.6.0
[AVHWDeviceContext @ 0x55ea8f484f80] libva: va_getDriverName() returns 0
[AVHWDeviceContext @ 0x55ea8f484f80] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x55ea8f484f80] libva: Trying to open /usr/local/lib/dri//iHD_drv_video.so
[AVHWDeviceContext @ 0x55ea8f484f80] libva: Found init function __vaDriverInit_1_6
[AVHWDeviceContext @ 0x55ea8f484f80] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55ea8f484f80] Initialised VAAPI connection: version 1.6
[AVHWDeviceContext @ 0x55ea8f484f80] VAAPI driver: Intel iHD driver - 1.0.0.
[AVHWDeviceContext @ 0x55ea8f484f80] Driver not found in known nonstandard list, using standard behaviour.
[rawvideo @ 0x55ea8f4d6c00] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from './720p_I420_1.yuv':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 276480 kb/s
    Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 1280x720, 276480 kb/s, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> vp8 (vp8_vaapi))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x55ea8f4e83c0] w:1280 h:720 pixfmt:yuv420p tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
[auto_scaler_0 @ 0x55ea8f4eb440] w:iw h:ih flags:'bicubic' interl:0
[Parsed_format_0 @ 0x55ea8f4e5cc0] 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 @ 0x55ea8f4eb440] w:1280 h:720 fmt:yuv420p sar:0/1 -> w:1280 h:720 fmt:nv12 sar:0/1 flags:0x4
[vp8_vaapi @ 0x55ea8f4e3840] Input surface format is nv12.
[vp8_vaapi @ 0x55ea8f4e3840] Using VAAPI profile VAProfileVP8Version0_3 (14).
[vp8_vaapi @ 0x55ea8f4e3840] Using VAAPI entrypoint VAEntrypointEncSlice (6).
[vp8_vaapi @ 0x55ea8f4e3840] Using VAAPI render target format YUV420 (0x1).
[vp8_vaapi @ 0x55ea8f4e3840] No quality level set; using default (40).
[vp8_vaapi @ 0x55ea8f4e3840] RC mode: CQP.
[vp8_vaapi @ 0x55ea8f4e3840] RC quality: 40.
[vp8_vaapi @ 0x55ea8f4e3840] RC framerate: 25/1 (25.00 fps).
[vp8_vaapi @ 0x55ea8f4e3840] Using intra and P-frames (supported references: 3 / 0).
[vp8_vaapi @ 0x55ea8f4e3840] Driver does not support any packed headers (none wanted).
Output #0, ivf, to 'out.ivf':
  Metadata:
    encoder         : Lavf58.33.100
    Stream #0:0: Video: vp8 (vp8_vaapi), 1 reference frame (VP80 / 0x30385056), vaapi_vld, 1280x720, q=-1--1, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.59.102 vp8_vaapi
No more output streams to write to, finishing.
frame=    1 fps=0.0 q=-0.0 Lsize=       0kB time=00:00:00.04 bitrate=   8.8kbits/s speed=1.39x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (./720p_I420_1.yuv):
  Input stream #0:0 (video): 1 packets read (1382400 bytes); 1 frames decoded; 
  Total: 1 packets (1382400 bytes) demuxed
Output file #0 (out.ivf):
  Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (0 bytes); 
  Total: 1 packets (0 bytes) muxed
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
[AVIOContext @ 0x55ea8f4e1580] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x55ea8f4df2c0] Statistics: 1382400 bytes read, 0 seeks

Attachments (1)

720p_I420_1.yuv (1.3 MB ) - added by Linjie.Fu 3 years ago.

Download all attachments as: .zip

Change History (3)

by Linjie.Fu, 3 years ago

Attachment: 720p_I420_1.yuv added

comment:1 by Linjie.Fu, 3 years ago

Patch has been sent to fix this:
https://patchwork.ffmpeg.org/patch/13340/

Previous version of patch and discussion with Mark:
https://patchwork.ffmpeg.org/patch/13323/

Media driver will return 2 buffers in fact. The first buffer is VACodedBufferSegment
buffer which includes encoded output. And the second buffer is extra VACodedBufferVP9Status.

Related driver ticket:
https://github.com/intel/media-driver/issues/624

comment:2 by Linjie.Fu, 2 years ago

Resolution: fixed
Status: newclosed
Last edited 2 years ago by Carl Eugen Hoyos (previous) (diff)
Note: See TracTickets for help on using tickets.