Log in

View Full Version : Preroll Causing Corrupted Frames


Chymerix
29th October 2011, 06:17
Hi,

I'm trying to use NeatVideo in conjunction with HDRAGC in Avisynth. The NeatVideo filter is configured to do some temporal filtering, and so has a preroll value of 5 frames.

HDRAGC has no temporal component and can begin processing immediately. The issue I'm encountering is that the preroll for the NeatVideo plugin seems to add some blank frames to the beginning of the clip. These blank frames cause the HDRAGC plugin to choose incorrect filter values and corrupt the initial few seconds of my video.

I've confirmed that everything works after removing the preroll, but I'd like to be able to use the temporal component of NeatVideo with HDRAGC. Does anyone have any ideas for getting these two filters to play nice with each other? I suspect that I have to delay the application of the HDRAGC filter somehow. I tried using ApplyRange, but I'm unable to pass parameter name-value pairs to the HDRAGC filter in the call to ApplyRange. Any help is appreciated.

Thanks!

Gavino
29th October 2011, 09:00
Simplest solution is probably to use Loop() to repeat the first frame several times, apply the filters, then remove the extra frames.

Loop(10,0,0) # adds 9 frames at start
... # filters
Trim(9,0) # remove added frames

Chymerix
29th October 2011, 19:26
Thanks for the quick reply. This worked for the video, but caused audio encoding to hang.

I have the following setup:

Sony Vegas Movie Studio --> DebugMode FrameServer --> AviSynth --> MeGUI.

When I load the avisynth script in MeGUI and start the encoding, the audio encode progress indicator stays stuck at zero.

Any ideas?

Gavino
29th October 2011, 20:56
The end result should be to deliver the original audio, so I don't know why it shouldn't work - perhaps some glitch with Loop() and audio?

Easiest solution is just to save the original audio and dub it back at the end:

orig=last
Loop(10,0,0) # adds 9 frames at start
... # filters
Trim(9,0) # remove added frames
AudioDub(orig) # add back original untouched audio track

Chymerix
30th October 2011, 00:02
I had to select the "Write audio as PCM samples in signpost AVI" option in DebugMode FrameServer and both snippets you provided worked. Thanks a lot; I'm amazed at the quality I can get from DV footage using this combination of programs and filters.

I'm curious about how this works, though - How does looping over the first frame avoid the issue? I'd expect it to loop over the initial black preroll frames, but instead I see no trace of the preroll. And even though the looped frames are trimmed at the end, wouldn't they be present when the HDRAGC filter is initializing?

IanB
30th October 2011, 00:19
To understand how an Avisynth graph runs you need to start at the end and work backwards calculating which frame numbers get asked for at each filter.

So first ...# External App
Ask for frame 0
# Trim(9,0)
Ask for frame 9
# filters (5 frame temporal ref)
Ask for frame 7,8,9,10,11
# Loop(10,0,0)
Ask for frame 0,0,0,1,2
# Cache
Ask for frame 0,1,2

And next ...# External App
Ask for frame 1
# Trim(9,0)
Ask for frame 10
# filters (5 frame temporal ref)
Ask for frame 8,9,10,11,12
# Loop(10,0,0)
Ask for frame 0,0,1,2,3
# Cache
Ask for frame 3

Gavino
30th October 2011, 00:29
Since the 'corruption' affects only the first few frames, the idea was to add some dummy frames at the start (here using Loop(), merely as the simplest way to achieve that), then trim off the extra frames at the end, so that the corruption affects only the dummy frames and not the real video.