Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6755 closed defect (invalid)

corrupt output and rate control issues when using vp9_vaapi encoder in CBR or VBR mode

Reported by: armena Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: vaapi
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

When using the vp9_vaapi encoder in CBR or VBR mode, the output video may be corrupted. At a dissolve from a full-screen logo to video from a camera, the output became garbled for several seconds. Also, in VBR mode, the output bitrate is approximately 1/2 of the requested value.

This was found using the i965 vaapi driver on an Intel Kabylake cpu. I attempted to reproduce using vp9enc (shipped with vaapi-utils) but was not able to do so, so my initial assumption is that this is an ffmpeg issue. I've been able to encode the same file successfully using other vaapi codecs (vp8, h264, hevc) with similar ffmpeg options.

How to reproduce:

/usr/local/bin/ffmpeg -vaapi_device /dev/dri/renderD128 -i /var/www/html/rpitv_test/20170121_whockey_union_p0.mp4 -vf "format=nv12,hwupload,deinterlace_vaapi,scale_vaapi=w=1920:h=1080" -c:v vp9_vaapi -b:v 4400k -bufsize 17600k -maxrate 4400k -g 150 -keyint_min 150 -bf 1 -bsf:v vp9_raw_reorder,vp9_superframe -an -f webm -dash 1 -r 29.97 20170121_whockey_union_p0-v4400.webm
ffmpeg version N-87873-g2e94490225 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
  configuration: --enable-libvorbis --enable-libvpx --enable-vaapi

Attachments (1)

ffmpeg-20171017-074326-head.log (97.7 KB ) - added by armena 7 years ago.

Download all attachments as: .zip

Change History (8)

by armena, 7 years ago

comment:1 by armena, 7 years ago

Also of note, I was not able to reproduce the corrupt output when encoding in constant-quality mode.

comment:2 by Carl Eugen Hoyos, 7 years ago

Keywords: vaapi added

comment:3 by jkqxz, 7 years ago

I can't reproduce this myself with the command-line given (I might be able to with the initial part of the input file?), but I can certainly believe this sort of problem will happen. The opaque rate control for VP9 in the Intel driver seems to be generally a bit flaky - e.g. see <https://github.com/01org/intel-vaapi-driver/issues/87> (not just the hang, you can also get broken output without other failure with that setup). I suggest reporting your case there; ideally remove as many of the options as you can to still get it.

comment:4 by armena, 7 years ago

Opened https://github.com/01org/intel-vaapi-driver/issues/284. There's a sample file there if you'd like to try to reproduce.

comment:5 by Zhong,Li, 7 years ago

The CBR corruption issue is a vaapi driver issue. And a patch has been sent there.
The input clip (20170121_whockey_union_p0.mp4) to be transcoded is a special, which has many repeat frames. That why Mark cann't reproduce it without the input file.

comment:6 by jkqxz, 7 years ago

Resolution: fixed
Status: newclosed

comment:7 by Carl Eugen Hoyos, 7 years ago

Resolution: fixedinvalid
Note: See TracTickets for help on using tickets.