Opened 3 years ago

Last modified 3 years ago

#9608 new defect

Ffmpeg + VAAPI on Polaris GPU not recovering after corrupt video

Reported by: teeedubb Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by teeedubb)

Hi All,

I have been experiencing heavy artifacting in dvb-t live TV streams after corruption in videos with ffmpeg + vaapi + AMD polaris GPU (rx560). The video in question is a live TV stream and I am able to reproduce the issue when the recording is played from a local harddisk. The issue occurs in linux and windows, in kodi, vlc and ffplay and the videos recover OK when played on nvidia and intel gpu's on both windows and linux. The video plays ok if I disable vaapi (most of my testing is done in linux).

I have tried updating mesa to the current release, using a 5.15 kernel and tried various operating systems (manjaro, libreelec nighty, ubuntu 20.04, windows 10).

output of
ffmpeg -hwaccel vaapi -i Downloads/The\ Project.ts -vcodec rawvideo -acodec copy -f matroska -sn - | ffplay -report -i -
https://paste.ubuntu.com/p/tP9zrjZ796/

snippets of kodi.log from when the corruption occurs (I can provide more logs)
2021-11-30 20:36:36.863 T:333115 DEBUG <general>: ffmpeg[0x56321c011040X]: [mpegts] Packet corrupt (stream = , dts = 2007374635).
2021-11-30 20:52:18.128 T:366796 DEBUG <general>: ffmpeg[0x56321b9c1730X]: [mpegts] Packet corrupt (stream = , dts = 2209044203).
2021-11-30 20:52:33.301 T:372941 DEBUG <general>: ffmpeg[0x7f559c0dec80X]: [image2] Custom AVIOContext makes o sense and will be ignored with AVFMT_NOFILE format.

vainfo
http://ix.io/3EE0 <http://ix.io/3EE0>

mediainfo of a longer version of the sample video
https://paste.ubuntu.com/p/wthYZhVMMf/

video of artefacting
https://youtu.be/EJCfi4RP5Pg

Sample video (200mb) Corruption occurs at around 4m40s.
https://www.dropbox.com/s/aaiwgvsou10aq2w/corruption-recovery-amd.ts?dl=0
I have also uploaded the sample file "corruption-recovery-amd.ts" to the VLC file uploader.

I have also received confirmation from two people that they can reproduce the issue on their polaris hardware:

https://www.reddit.com/r/ffmpeg/comments/r66bns/any_rx560_or_amd_gpu_owners_out_there_that_can/htp8vil/
"I tried it out and got exactly what you're experiencing, I have a 2gb RX560. If I played the video through about 4:38 in VLC it would drop about 25 frames, and it wouldn't matter where I seeked the video to, it would be all garbled. Not only that, but my gpu utilization would go from about 10% while decoding to 50% once the frames dropped, spiking all over the place. I tried to play the video again, skipping over the corrupted frames, and there were no problems if I skipped over the bad part. I'm sure you're long past worrying about this by now, but I thought I'd pitch in anyway that the same thing happens for me. See screenshot. My CPU at 100% is because I am also transcoding video in the background on CPU."

and https://forums.whirlpool.net.au/thread/90x14jy4
"Can confirm the video desync and corruption issue using VLC with RX550 / Polaris12 – it looks like an issue decoding an I frame and the decoder never recovers so corrupt macroblocks appear

Playing the video with mpv + hardware acceleration has no issues

In Windows VLC with integrated Intel UHD graphics + DXVA2 acceleration, the playback temporarily freezes, skips some frames and then snaps back cleanly to the next I frame"

Thanks in advance.

Change History (1)

comment:1 by teeedubb, 3 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.