Opened 4 years ago

Closed 4 years ago

#8391 closed defect (duplicate)

VA-API VP8 encoding produces broken videos with iHD driver

Reported by: eero-t Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: vaapi
Cc: linjie.fu@intel.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

VP8 encoding produces broken videos with iHD driver, while i965 driver works fine with the same FFmpeg version.

How to reproduce:

  1. Get e.g. quicktime/AVC "trailer_480p.mov" trailer from here: https://peach.blender.org/trailer-page/
  2. Convert it to VP8 with i965 and iHD drivers:
    $ export LIBVA_DRIVER_NAME=i965
    $ ffmpeg -y -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i trailer_480p.mov -c:v vp8_vaapi test-i965.webm
    ...
    $ export LIBVA_DRIVER_NAME=iHD
    $ ffmpeg -y -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i trailer_480p.mov -c:v vp8_vaapi test-iHD.webm
    ffmpeg version N-95809-g804fce8bc2 Copyright (c) 2000-2019 the FFmpeg developers
      built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
    ...
    $ ls -s test*.webm
    4084 test-i965.webm   1296 test-iHD.webm
    

Both FFmpeg runs give the same output, but saved file sizes differ a lot.

i965 encoded video plays back fine both with Chromium and ffplay. But with the iHD encoded video, Chromium shows just black video, and ffplay does never even open an output window (it just shows time advancing on console).

I didn't find any input video which iHD would encode properly, but there were videos where it worked worse; after encoding the video, output file size was minuscule and FFmpeg commented:

Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

I don't know whether this is regression, because earlier VP8 hasn't worked properly on the iHD driver side, e.g. due to these issues:

Latter issue was/is due to something that FFmpeg should do, but it doesn't. If FFmpeg is (still) using the wrong buffer as encoding result, that would easily explain broken video files.

(FFmpeg QSV backend doesn't support VP8, at least on GEN9, and neither does MediaSDK transcoding sample app, so I couldn't test whether this issue is specific to FFmpeg, or underlying iHD media driver => had to file it against FFmpeg.)

Change History (5)

in reply to:  description ; comment:1 by Carl Eugen Hoyos, 4 years ago

Keywords: vaapi added

Replying to eero-t:

Summary of the bug:

VP8 encoding produces broken videos with iHD driver, while i965 driver works fine with the same FFmpeg version.

Why do you believe that there is an issue that can be fixed in FFmpeg?

in reply to:  1 ; comment:2 by eero-t, 4 years ago

Replying to cehoyos:

Why do you believe that there is an issue that can be fixed in FFmpeg?

Last comment in the media-driver bug I linked, states that:
"Media driver will return 2 buffers. One is coded data buffer, another is some additional suggestion info for future encoding. So ffmpeg should ignore the 2nd buffer if it doesn't care theses suggested info."

Subject of that bug was:
ffmpeg exits with "Output file is empty, nothing was encoded"

Which is the same issue I saw with most of the videos I tried encoding.

Btw. Based on this: https://github.com/intel/media-driver/issues/624

There may be a similar issue with VP9.

in reply to:  2 comment:3 by Linjie.Fu, 4 years ago

Cc: linjie.fu@intel.com added

Replying to eero-t:

Replying to cehoyos:

Why do you believe that there is an issue that can be fixed in FFmpeg?

Last comment in the media-driver bug I linked, states that:
"Media driver will return 2 buffers. One is coded data buffer, another is some additional suggestion info for future encoding. So ffmpeg should ignore the 2nd buffer if it doesn't care theses suggested info."

Subject of that bug was:
ffmpeg exits with "Output file is empty, nothing was encoded"

Which is the same issue I saw with most of the videos I tried encoding.

Btw. Based on this: https://github.com/intel/media-driver/issues/624

There may be a similar issue with VP9.

Hi Eero,

would you please help to verify with current FFmpeg git head?

This is supposed to be fixed by:
https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/efefba61f8513e9d909af041b17584fd82775c63

comment:4 by Linjie.Fu, 4 years ago

comment:5 by eero-t, 4 years ago

Resolution: duplicate
Status: newclosed

Works fine now, sorry for the late verification.

Also, duplicate with: https://trac.ffmpeg.org/ticket/8341

Setting as dup.

Note: See TracTickets for help on using tickets.