1 (edited by Mystery 06-03-2019 17:24:37)

Topic: Inject SVP script in custom AVS file?

When playing videos, I have this ridiculous chain:
- Video loaded via an Avisynth script to change the pitch from 440hz to 432hz
- Video passed to SVP via ffdshow
- Video runs through another Avisynth script
- Video is rendered in HPC-HC via madVR

I'm just thinking. Would it be possible to have a single Avisynth instance running, to inject the code that would run into the first script I'm loading? Then no ffdshow and only 1 Avisynth engine running, should improve performance and stability. But is there any way it can be done? The challenge would be getting the per-video configuration that SVP Manager needs to generate.

I think such feature would require a specific API support from the Manager; and it could notify to reload if settings change.

Re: Inject SVP script in custom AVS file?

Cross-referencing this thread, such a workflow of loading the avisynth script into MPC-HC instead of capturing it via ffdshow would allow for 10-bit output.

Re: Inject SVP script in custom AVS file?

Not sure this could be useful to anybody else.

----
10bit is almost useless w/o passing HDR meta data to the player. I doubt AVS+ can do this hmm

4 (edited by Mystery 07-03-2019 03:12:34)

Re: Inject SVP script in custom AVS file?

MPC-HC can open 10-bit Avisynth script no problem. It views it like this

Video: Y3 640x480 24fps [V: rawvideo, yuv420p10le, 640x480]

5 (edited by Mystery 07-03-2019 03:22:57)

Re: Inject SVP script in custom AVS file?

I see you added a "Temporarily disable SVP" which can avoid me from killing the process to disable it; still have to see how to use that from code.

If I wanted to do this flow, I would have to:
- Let SVP open the video via ffdshow
- Intercept the generated AVS file
- Disable SVP
- Modify/inject the intercepted script into my player script
- Load it into MPC-HC

This could work but would cause even more glitching on loading videos.

Any way I can ask SVP to generate the script for a given video file without playing it? Or perhaps it would have to believe my own application is playing it and SVP would kick in while I control the playback?

Additionally, I'm just thinking -- it could be possible to run SVP in Vapoursynth (which doesn't support audio), then load that script in Avisynth and load the Audio alongside it. Is the performance and stability of SVP better in Vapoursynth than in Avisynth? As an additional benefit, then I can also run MPC-HC in x64.

Re: Inject SVP script in custom AVS file?

> MPC-HC can open 10-bit Avisynth script no problem.

I'm not talking about plain 10-bit, I'm talking about HDR.
The only reason this workflow (SVP generates AVS script, MPC-HC plays the script) would be interesting to implement is IF it'd be able to play HDR rips with SVP in MPC-HC.

7 (edited by Mystery 07-03-2019 14:34:54)

Re: Inject SVP script in custom AVS file?

madVR supports HDR content; can you get madVR to render HDR correctly when playing an Avisynth script file instead of opening the file directly? Or what's the problem exactly

Re: Inject SVP script in custom AVS file?

HDR is not just a raw 10-bit video stream. HDR needs additional meta-data. I'm 100% sure Avisynth/plus doesn't handle this additional data.

Re: Inject SVP script in custom AVS file?

This plugins converts HDR to SDR
https://www.videoartifact.com/hdr/

10 (edited by Mystery 12-03-2019 13:22:07)

Re: Inject SVP script in custom AVS file?

With the current SVP Manager, is there any reasonable way I could implement this workflow? Perhaps initiate the playback and script into a separate player that SVP manages (would have to look at the best way to do so), and then play it into a player that I control.

11 (edited by Mystery 16-03-2019 13:23:01)

Re: Inject SVP script in custom AVS file?

I tried taking the generated SVP script and merging it with the AVS file I'm opening in MPC-HC. In x86, the CPU difference is marginal. (but this workflow would allow for x64)

What surprises me is, there are more dropped frames when opening the script directly than when playing via ffdshow! When the script lags behind playback, then playback becomes all jerky and it doesn't recover well at all. Ffdshow appears to allow for smoother recovery and smoother playback.

Which brings up another issue I hadn't realized before. In scenes with high animations, with 55% CPU usage and 70-80% GPU usage, I can get tons of dropped frames! Even when opening the video file directly in the player with only SVP. What's causing these dropped frames? Obviously it's taking longer to compute highly-animated scenes, but the CPU is still half-available.

Re: Inject SVP script in custom AVS file?

"55%" CPU usage can mean anything up to 110% big_smile in case of hyper-threading enabled

13 (edited by Mystery 18-03-2019 07:30:22)

Re: Inject SVP script in custom AVS file?

Just had an even better idea. Let MPC-HC play the video directly, and make it load the 432hz audio track next to it by having both files with the same name but different extension. I can use Avisynth Virtual File System to expose the script as a WAV file next to the video file and it will load with it. Not sure if there's another way to make it load the audio track.

Re: Inject SVP script in custom AVS file?

Only if you don't care about audio synchronization.

15 (edited by Mystery 18-03-2019 12:13:55)

Re: Inject SVP script in custom AVS file?

Ya I care about audio sync. This *will* cause sync issues? I did some quick tests of loading video and audio files separately and haven't seen sync issues so far. In which cases it would?

Re: Inject SVP script in custom AVS file?

Mystery wrote:

This *will* cause sync issues?

just a guess

17 (edited by Ironclad 29-06-2019 15:50:24)

Re: Inject SVP script in custom AVS file?

According to this, HDR is treated like a regular color format.
https://forum.doom9.org/showthread.php?t=175205
http://avisynth.nl/index.php/Avisynthplus_color_formats
https://github.com/FFMS/ffms2/blob/mast … visynth.md