CrendKing / avisynth_filter

DirectShow filters that put AviSynth and VapourSynth into video playing
MIT License
107 stars 8 forks source link

Does AviSynth Filter support D3D11 hardware decoder? (re: LAV Filters, etc) #46

Closed sofakng closed 3 years ago

sofakng commented 3 years ago

Here is my configuration:

If I select 'D3D11' (native or copy-back) with LAV then I get a black screen. If I select 'DXVA2' (native or copy-back) it works but is extremely slow with 7K or 8K video.

The only method I can successfully play 7K or 8K is using D3D11 (native) or DXVA2 (native).

1) Does AviSynth Filter (or AviSynth+ itself?) support D3D11 hardware decoding in LAV Filters? 2) Does AviSynth Filter (or AviSynth+ itself?) force DXVA2 (native) into copy-back mode? For example, my 7K/8K videos playback perfectly with DXVA2 (native) but adding AviSynth Filter (but no scripts!) causes the playback to become extremely slow similar to copy-back methods.

CrendKing commented 3 years ago
  1. AviSynth Filter does not care about your acceleration settings in LAV. However you get the frames decoded, AVSF gets the decoded frames, and the processing is the same.
  2. Please post a log for black screen.
  3. I don't have a 7K video to test, but if there is no script used, there should be no big performance issue. Log file?
  4. BTW, hardware acceleration might not be the best to use when you have sufficiently powerful CPU. According to mpv, "Hardware decoding is not enabled by default, because it is typically an additional source of errors. It is worth using only if your CPU is too slow to decode a specific video."
sofakng commented 3 years ago

Thanks so much for the information.

I understand that AviSynth Filter doesn't care about acceleration, but my question was regarding DXVA2/D3D11 native versus copy-back. I'm wondering if 'native' mode is compatible because I do not believe it provides access to the decoded frame (ie. it stays in GPU memory until it's displayed?)

Here is the log file from MPC-HC using LAV Filters configured for D3D11 (copy-back): avisynth_filter.log

Thanks so much for the help!

CrendKing commented 3 years ago

I do not believe it provides access to the decoded frame (ie. it stays in GPU memory until it's displayed?)

You are correct that if "native" is active, the frames stay in GPU. However, if LAV detects that it's not directly connected to a supported renderer (such as EVR or madVR), the acceleration will not be activated. It falls back to software decoding.

In case of copyback, downstream filter has access to the decoded frames, at the cost of performance of course.

So the moment you decide to use any software filter, you forfeit any native hardware accel mode. That's also why we provide the "Disconnect" function to give you chance to not introduce this filter into the graph.

I got the log, but I don't see any obvious error message. No frame is received in AVSF, so something is wrong at LAV-AVSF side. One thing to note that my GPU (2070 Super) can't accel any P010/P016 or 4:4:4 video. But your 3080 might be. So I can't fully reproduce your problem on my end.

Again, if software decoding is already good enough for you and fully working, try to stay in software.

CrendKing commented 3 years ago

Closing due to inactivity. Feel free to reopen if you have more questions.