Nevcairiel / LAVFilters

LAV Filters - Open-Source DirectShow Media Splitter and Decoders
GNU General Public License v2.0
7.41k stars 787 forks source link

Stuttering Video on AMD GPU with DXVA on some H.264 LiveTV streams #496

Open YARD2 opened 2 years ago

YARD2 commented 2 years ago

System Info: Ryzen 5 2500U with Vega iGPU Windows 10

I noticed that on a few TV Live streams with h264 / recordings via satellite (Astra 19.2) results in stuttering video if DXVA is enabled on AMD GPUs. Intel and Nvidia are OK. Without DXVA (using Software decoding) it is also OK. But it works with the Microsoft Filter DTV Video Decoder and DXVA.

Tested with: LAVFilter 0.76.1 with DVBviewer MPC-HC newest version

Sample: Sample

psyborg55 commented 2 years ago

Maybe not the same problem, but is also noticeable on Eutelsat 7east channel CineFilm. AMD GPU as well. I think channel use L4.1 format, while most others are L4.0

mitzsch commented 2 years ago

Noticed a similar issue on my end too. GPU is a RX580. The end crawl of a single Bluray rip is stuttering like a mess, turning off the hw decoding fixes it. Works fine with an Nvidia GPU. Interestingly I could not recreate the problem with your sample. @YARD2

Another thing I noticed is, that the same issue also shows up when using mpv (maybe you (@YARD2) could try mpv too? ), however only in windows - under linux using vaapi it was fine. (your sample was fine there too)

YARD2 commented 2 years ago

mpv is working in Windows with the latest build i tried.

vdrfan commented 1 year ago

I have a similar problem (buggy DXVA on some TV Live Streams). But older Driver works (last working 20.12.1). My Problem is - i cannot use old Driver becouse of a HDR Bug in old Driver.

I spend the whole day with testing Adrenalin Drivers to find working Drivers.

i can test 3200G, 3400G, 5600G with two different Mainboards, and all of them having the same problem.

here are my result: testfiles: https://drive.google.com/file/d/1WBjMTsYIGX2S32s91UME7HA_8o1KuutM/view?usp=sharing

tested with MPC-BE Renderer doesn't matter - (EVR/MADVR/MPCVR). Decoder: MPC Decoder - DX11 Hardware Decode info: VLC has same problem.

tested working Drivers: 19.9.2, 20.12.1 (and maybe all between of them)

tested buggy Drivers: 21.2.3, 21.4.1, 21.5.2, 21.6.1, 21.8.2, 21.9.1, 21.10.2, 21.10.3, 21.11.1, 21.12.1, 22.1.1, 22.1.2, 22.2.1, 22.2.2, 22.2.3, 22.3.1, 22.3.2, 22.4.1, 22.4.2, 22.5.1, 22.5.2, 22.6.1, 22.7.1, 22.8.1, 22.10.2, 22.10.3, 22.11.1

i did not find a working driver starting from 21.2.3 some of them(21.2.3, 21.4.1, 21.5.2) are starting playing without problems, and get buggy when skipping.

Clemens12345 commented 1 year ago

Same issue here with 6700 xt. Reported it also to AMD via their tool, is probably more an issue of AMD (hw or driver) then of LAV. Will maybe do a test with my R7 7700x as well, but probably need to remove my GPU for that as I can not select the other device in the menu. https://www.dropbox.com/s/3xen8e8axfmf7py/01-07_16-33-14_VTM%204_Top%20Gear%20-%20S30%20E03.%20Freddie%20Flintoff%2C%20Chris%20Harris%20en%20Paddy%20M.ts?dl=0

kasper93 commented 1 year ago

Could you try reporting it here? https://github.com/GPUOpen-LibrariesAndSDKs/AMF it has higher chance going to correct people.

And indeed I've seen it too where interlaced files are completely unplayable. It is probably regression in driver, because it used to work.

TomArrow commented 1 year ago

Was just googling AMD DXVA video playback stuttering and landed here. Just thought I'd add - for moral support - I also get video playback stuttering with DXVA in MPC-HC. Not sure if this is LAV related (dunno if MPC-HC uses LAV), but I definitely think this is an AMD issue. Was a problem on a few months old drivers as well as current drivers. Specifically for me it tends to happen when I try to playback a video at slower or faster speed. It stutters really badly for a while but eventually it "settles" and plays back decently, which is really strange. And when I go back to normal speed the stuttering is back for a while until it resolves.

vdrfan commented 1 year ago

it has nothing to do with LAV, VLC has same problem. there are working AMD drivers 19.9.2 and 20.12.1. my observation: playback is like slow motion - and error does not recover.

clsid2 commented 1 year ago

Use a GPU monitoring tool to check if maybe it gets stuck in a low clockspeed or low memory speed state. Maybe it is downclocking too aggressively.

vdrfan commented 1 year ago

i checkd GPU in taskmanager, nothing special found. this bug cannot be from downclocking - movie plays with 1 frame per second. there are working drivers - it must be a driver issue. i filmed it. https://drive.google.com/file/d/1sgcMGeGMLNe74OtB7unfZ9-dupT49ORd/view

clsid2 commented 1 year ago

It is obvious that it is a driver bug. The driver controls the power states. Task manager is crap. Use something like GPU-Z.

vdrfan commented 1 year ago

it will bring us nothing further (if power states causes problem). i already know that this is a driver problem. i will test it tomorrow with GPU-Z.

vdrfan commented 1 year ago

GPU-Z version: working 4k https://drive.google.com/file/d/19FH_eY8xK76flb4TX3WEMDUkz4I758sl/view?usp=share_link error 1280p https://drive.google.com/file/d/19EF3CVHOGmAROQZSafKAImLev9vuHe80/view?usp=share_link

TomArrow commented 1 year ago

Is 20.12.1 the last version people know about that still worked fine?

vdrfan commented 1 year ago

Yes. but 20.12.1 driver has a HDR Bug. https://github.com/Aleksoid1978/VideoRenderer/issues/71 how can we tell AMD to fix it.

Clemens12345 commented 1 year ago

Not solved with 23.2.1 on 6700 xt. :(

vdrfan commented 1 year ago

Same issue here with: Asus Vivobook Pro 16X OLED M7600QE (Ryzen 5800H). I think all IGPUs from AMD have this problem (i can only test VEGA) Is there any Graphics from AMD without that issue, maybe RDNA is ok?

kasper93 commented 1 year ago

testfiles: https://drive.google.com/file/d/1WBjMTsYIGX2S32s91UME7HA_8o1KuutM/view?usp=sharing

Those samples works correctly with Microsoft DTV-DVD Video Decoder. Can do over 400 fps on my GPU, while LAV/ffmpeg goes up to 40, which results in not smooth playback on this 50fps file.

Driver issue is only with interlaced samples, progressive ones seem to work correctly in non ffmpeg based decoders.

vdrfan commented 1 year ago

@kasper93, my samples are progressiv. and it has nothing todo with Video Decoder (every Video Decoder has the same problem when you usw HW Decoding). if you have Veag Graphics - can you test with this file: https://drive.google.com/file/d/1WBjMTsYIGX2S32s91UME7HA_8o1KuutM/view

kasper93 commented 1 year ago

@vdrfan: Maybe there are some preconditions to make it not work. But like I said for me the 720p ERROR.ts file works ok with Microsoft's decoder. While interlaced samples reliably doesn't work on anything.

The point I'm making here is that while there may be a driver issue, at least progressive samples can be fixed in userspace. And there is definitely difference between decoders at least for this specific file.

vdrfan commented 1 year ago

@kasper93, my mistake. i thought you have testet with your own files. with Microsoft DTV-DVD Video Decoder, the testfiles are working. ffmpeg based decoders(LAV, MPC ...) have the problem with Vega Graphics? can we tell that ffmpeg devs to fix it.

funny: Microsoft DTV-DVD Video Decoder thinks it is interlaced: dwInterlaceFlags: 0x00000081(AMINTERLACE_IsInterlaced and AMINTERLACE_DisplayModeBobOrWeave), but it is is progressiv.

vdrfan commented 1 year ago

@kasper93, interlaced Videos are working with ffmpeg based decoders, but not with Microsoft DTV-DVD Video Decoder progressiv video exactly reversed (not working with ffmpeg, working with Microsoft DTV). frustrating. interlaced Sample: https://drive.google.com/file/d/1-Ih1p8sUhPEvwKft6pba-Dxn7Ckuan1a/view?usp=sharing progressiv Sample: https://drive.google.com/file/d/1WBjMTsYIGX2S32s91UME7HA_8o1KuutM/view?usp=share_link

Clemens12345 commented 1 year ago

Just installed latest 23.8.1 driver on my Windows PC with 6700xt. When selecting DXVA2, SW decoding seems to be used. When selecting D3D11, HW decoding seems to be used and the problem seems to be solved. Can some one confirm this?

EDIT when using EVR custom renderer instead of MPC video renderer, DXVA2 works, and also there problem seems to be solved. Will maybe check Linux as well somewhere coming days as I had the problem there as well.

EDIT2 have the issue still sometimes, but issue seems to recover after 1-2 seconds.

Clemens12345 commented 1 year ago

Can be just an impression, looks even better with drivers 23.9.1. Confirmation of someone else would be nice (and then this issue can be closed here). Linux I might test next weekend / next week.

kasper93 commented 1 year ago

I can still reproduce the issue on 23.9.1. Not with all samples, but try Sample2_#2750.zip it is really bad.

It looks like it gives frames out of order from the decoder, with a little bit of seeking you can sometimes fix it, but it general it breaks.

Clemens12345 commented 1 year ago

@kasper93 I tried that sample, have it the first 2 seconds or so but then it recovers and is fine ( I guess it recovers at the second iframe or so, would need to check when exactly those are) Which card? Here 6700 xt.

Timohal commented 1 month ago

I confirm