Opened 4 weeks ago

Closed 5 days ago

#7502 closed defect (worksforme)

VAAPI encoding on Coffee Lake skipping/missing frames

Reported by: dseeker Owned by:
Priority: normal Component: undetermined
Version: unspecified 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 dseeker 4 weeks ago.
report of file
ffmpeg-20181019-095956.log (842.2 KB) - added by dseeker 4 weeks ago.
report h264_vaapi intra
ffmpeg-20181019-100017.log (725.2 KB) - added by dseeker 4 weeks ago.
report hevc_vaapi
vaapi_skipping-frames_h264.mp4 (2.4 MB) - added by dseeker 4 weeks ago.
h264_vaapi output skipping frames

Change History (10)

Changed 4 weeks ago by dseeker

report of file

Changed 4 weeks ago by dseeker

report h264_vaapi intra

Changed 4 weeks ago by dseeker

report hevc_vaapi

Changed 4 weeks ago by dseeker

h264_vaapi output skipping frames

comment:1 Changed 4 weeks ago by dseeker

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 Changed 4 weeks ago by cehoyos

  • Component changed from ffmpeg to undetermined
  • 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 Changed 2 weeks ago by jkqxz

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 Changed 2 weeks ago by dseeker

@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 Changed 5 days ago by dseeker

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 Changed 5 days ago by dseeker

  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.