Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#7502 closed defect (fixed)

VAAPI encoding on Coffee Lake skipping/missing frames

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


Summary of the bug:

Using h264_vaapi encoder on an Ubuntu 16.04 with Intel i9-8700 on .mov input outputs video stream with only keyframes. The result is a video with still frames changing every 3-5 seconds.

The same encoder (h264_vaapi) works normally on other h264 input.
Using -intra with h264_vaapi outputs all frames correctly.
Switching from h264_vaapi to hevc_vaapi encodes properly with all frames.

ffmpeg version 4.02 built on docker container (vaapi) from
problem also occurs on the 3.x container

How to reproduce:

% ffmpeg -stats -report -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -hwaccel vaapi -t 30 -i -an -filter_complex "format=nv12|vaapi,hwupload" -c:v h264_vaapi -qp 28 -bf 0 -compression_level 0 -quality 0 output.mp4 -y

Attachments (4)

ffmpeg-20181019-095930.log (724.5 KB ) - added by Dan Seeker 6 years ago.
report of file
ffmpeg-20181019-095956.log (842.2 KB ) - added by Dan Seeker 6 years ago.
report h264_vaapi intra
ffmpeg-20181019-100017.log (725.2 KB ) - added by Dan Seeker 6 years ago.
report hevc_vaapi
vaapi_skipping-frames_h264.mp4 (2.4 MB ) - added by Dan Seeker 6 years ago.
h264_vaapi output skipping frames

Change History (11)

by Dan Seeker, 6 years ago

Attachment: ffmpeg-20181019-095930.log added

report of file

by Dan Seeker, 6 years ago

Attachment: ffmpeg-20181019-095956.log added

report h264_vaapi intra

by Dan Seeker, 6 years ago

Attachment: ffmpeg-20181019-100017.log added

report hevc_vaapi

by Dan Seeker, 6 years ago

h264_vaapi output skipping frames

comment:1 by Dan Seeker, 6 years ago

PS: I tried connecting to the FTP to upload the source but it's timing out
here's a google drive link to the source

comment:2 by Carl Eugen Hoyos, 6 years ago

Component: ffmpegundetermined
Keywords: h264 linux coffeelake intel quicksync removed

Please test current FFmpeg git head and provide the log file, no other version is supported here.

comment:3 by jkqxz, 6 years ago

Can you try with <> applied?

The only problem I can see here is that the SAR gets written incorrectly because it doesn't fit in the 216 range. I'm not sure how that causes the observed issue, but fixing it seems to help.

That is, if I fix the SAR in your file with:

ffmpeg -i vaapi_skipping-frames_h264.mp4 -c:v copy -bsf:v h264_metadata=sample_aspect_ratio=1 output.mp4

then the output file plays correctly where the input did not.

comment:4 by Dan Seeker, 6 years ago

@jkqxz yes changing the sample_aspect_ratio did correct all the frame encoding, even thou the aspect ratio got distorted. I'll try to get the value somewhere else and enforce it.

I noted this message when trying to re-encode the file for testing, may have something to do with it?

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5598d1728000] sample aspect ratio already set to 93207:65536, ignoring 'pasp' atom (118:81)

I will try to update the build, but since I'm using the hosted docker container I haven't a clue how to update the branch there.

comment:5 by Dan Seeker, 6 years ago

This fraction problem seems to extend beyond the vaapi encoder. The same content outputs incorrectly with image extraction (png or jpg). it's necessary to manually add scaling with the appropriate AR to adjust, otherwise the output scaling is incorrect.

I couldn't test the new branches, but was able to fix all the problems with manually overriding the AR truncating to 6 digits

comment:6 by Dan Seeker, 6 years ago

Resolution: worksforme
Status: newclosed

comment:7 by Carl Eugen Hoyos, 6 years ago

Component: undeterminedavcodec
Resolution: worksformefixed
Version: unspecifiedgit-master
Note: See TracTickets for help on using tickets.