Opened 4 years ago
Closed 4 years ago
#8959 closed defect (fixed)
[ffmpeg][avc/hevc encode][regression]A commit caused all avc/hevc encode cases in ffmpeg-vaapi fail!
Reported by: | yefeng | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avcodec |
Version: | git-master | Keywords: | vaapi regression |
Cc: | ullysses.a.eoff@intel.com | Blocked By: | |
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | yes |
Description
Summary of the bug:
How to reproduce:
ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -v verbose -f rawvideo -pix_fmt yuv420p -s:v 320x240 -r:v 25 -i <input> -vf 'format=nv12,hwupload' -c:v h264_vaapi -profile:v high -rc_mode CBR -g 30 -slices 1 -bf 0 -b:v 500k -maxrate 500k -low_power 0 -y <output>
ffmpeg version N-99800-g7369595c55
commit 7369595c556516b90bf3acdf85043dc11add7d89 caused this issue.
Output:
[h264_vaapi @ 0x55f5559b0800] colour_primaries does not match inferred value: 0, but should be 2. [h264_vaapi @ 0x55f5559b0800] Failed to write unit 0 (type 7). [h264_vaapi @ 0x55f5559b0800] Failed to write packed header. [h264_vaapi @ 0x55f5559b0800] Failed to write per-sequence header: -1094995529. [h264_vaapi @ 0x55f5559b0800] Encode failed: -1094995529. Video encoding failed [AVIOContext @ 0x55f5559bbc40] Statistics: 0 seeks, 0 writeouts [AVIOContext @ 0x55f5559ac000] Statistics: 6220800 bytes read, 0 seeks Conversion failed!
Change History (9)
comment:1 by , 4 years ago
Reproduced by developer: | set |
---|
comment:2 by , 4 years ago
[Parsed_scale_0 @ 0x3585ec0] w:320 h:240 fmt:yuv420p sar:0/1 -> w:320 h:240 fmt:nv12 sar:0/1 flags:0x4 [h264_vaapi @ 0x3c2de40] range: tv, primaries: unknown (2), trc: unknown, colorspace: unknown, chroma sample location: unspecified
So swscale specifically notes that it is limited range, which is why vf_scale appears to set that value to the AVFrame, and thus that is the only field set in the AVFrame as there is no further color information available.
Edit:
The primaries value passed to the h264 VAAPI encoder is seemingly properly 2.
comment:3 by , 4 years ago
Analyzed by developer: | set |
---|---|
Component: | undetermined → avcodec |
Seems like this is due to the VAAPI H.264 and HEVC encoders handling the VUI flags incorrectly. Mark was nice enough to come up with a patch which seems to have worked. Hopefully he posts it on the ML soon, HEVC I unfortunately cannot myself test but the logic should be the same.
As the result of the patch, the colour values are not left to possibly illegal values (the structure is zero-initialized)
comment:4 by , 4 years ago
Keywords: | regression added |
---|---|
Priority: | critical → important |
comment:5 by , 4 years ago
comment:6 by , 4 years ago
the patches fix this issue: https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=2682
comment:7 by , 4 years ago
Thanks @yefeng for confirming the patches fix this without new regressions.
Thanks @jkqxz for the patches. Can these be merged ASAP?
comment:8 by , 4 years ago
LGTM'd the set, as @jkqxz wakes up he can push it in :) . Tested the H.264 and MPEG-2 Video encoders with my X230 with and without additional color metadata.
comment:9 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch set has been pulled in as:
9faf4dcf234dbc34f05cd2d973473df2eece4881
486817e1aedda759bd21287b462ee0bb6e100949
755203c2d270e1334987b462f80151eb88e30121
Repro'd locally on my X230 Thinkpad. The input appears to not have anything set as far as colorspace information is concerned, but I will check what libavfilter actually returns :) .