View Full Version : "null" output device for avisynth?
davidlallen
7th February 2004, 17:56
Folks,
I have written a simple plugin which prints some statistics to a
text logfile. The filter should only take a few milliseconds per
frame, and I would like it to run at "full speed" without waiting
for any frame receiver. When I read the avs using Media Player,
it obviously runs at "realtime", so it takes one hour to print
statistics on a one hour clip.
I found at least one other thread here requesting a unix-like
"/dev/null" infinite speed receiver, but I didn't find any
solution.
Is there any way I can run avisynth with no frame output so
my statistics can be computed faster than realtime?
Thanks in advance,
- Dave Allen: dave@jendaveallen.com
Bidoche
7th February 2004, 19:45
You can't have avisynth run with no frame output, but you can make a dummy output fast enough to suit your needs.
Just divide the frame count by 100 (or 1000), and return one frame out 100 passed.
This will increase an hundred fold how much media player pumps frames in your filter.
sh0dan
7th February 2004, 19:51
Originally posted by davidlallen
Is there any way I can run avisynth with no frame output so
my statistics can be computed faster than realtime?
You can make AviSynth request any number of frames at any time. In principle you can request all your needed frames in the constructor instead of doing it in GetFrame. This will make all computations before the script is returned to vdub - but vdub will hang as long as the calculation is being done.
My favorite filter for timining is however Kronos, as it can measure any part of the filter chain.
davidlallen
7th February 2004, 21:53
Bidoche,
> Just divide the frame count by 100 (or 1000), and return one
> frame out 100 passed.
> This will increase an hundred fold how much media player pumps
> frames in your filter.
I don't quite understand. I tried the following in my constructor:
vi.num_frames /= 1000;
vi.num_audio_frames /= 1000;
Sure enough, it runs 1000x faster. But, my statistics are only
printed for the first few frames. For example, in a 10,000
frame clip, my GetFrame function is only called for the first 10
frames. Did I misunderstand what you suggested?
Thanks in advance,
- DaveA
davidlallen
7th February 2004, 21:57
Sh0dan,
> In principle you can request all your needed frames in the
> constructor instead of doing it in GetFrame. This will make all
> computations before the script is returned to vdub
I tried that. However, this appears to get all the frames
regardless of any previous filters. For example, if I have
written a script like this:
DirectShowSource("c:\test.mpg"
Trim(1000,2000)
MyStatisticPrintingPlugin()
My statistics printing plugin appears to be called for every
frame, not just 1000-2000.
Is there another way to get this "full speed" effect?
- DaveA
sh0dan
7th February 2004, 22:29
You filter will be called with frames 0->1000, as all filters start at frame 0. You cannot however know which frame is being requested first, or assume anything about the order.
The first frame requested from DSS will for instance be 1000.
Originally posted by davidlallen
I don't quite understand. I tried the following in my constructor:
vi.num_frames /= 1000;
Sure enough, it runs 1000x faster. But, my statistics are only
printed for the first few frames. For example, in a 10,000
frame clip, my GetFrame function is only called for the first 10
frames. Did I misunderstand what you suggested?
Thanks in advance,
- DaveA
What you are doing is telling AviSynth that there are only frames / 1000 in your movie. If you wish to remap framenumbers, you need to do:
n *= 1000;
... when GetFrame is being called, but before requesting frame 'n' from the previous filter. This will take the framenumber and multiply it by 1000, so when your filter is requested to deliver frame 3, you will request frame 3000 from the filter above you.
esby
7th February 2004, 23:58
When I read the avs using Media Player,
it obviously runs at "realtime", so it takes one hour to print
statistics on a one hour clip.
Don't use a player to read the file...
Just use virtualDub
for example with scan video frames for error option
You'll be sure the video will be decoded at max speed...
esby
Bidoche
8th February 2004, 01:44
I meant that you lower the number of frames outputted, not those entered.
That is to say, when requested frame n, you return frame n * 1000, but not before getting and logging frames n * 1000 to n * 1000 + 999.
Anyway, the method suggested by esby should do just fine.
davidlallen
8th February 2004, 17:33
esby wrote:
> Don't use a player to read the file...
> Just use virtualDub
> for example with scan video frames for error option
Ah-ha. That's much closer to what I was originally looking for.
That works.
Bidoche wrote:
> I meant that you lower the number of frames outputted, not those
> entered. That is to say, when requested frame n, you return frame
> n * 1000, but not before getting and logging frames n * 1000 to
> n * 1000 + 999.
I got something similar to work. Sh0dan suggested accessing all
the frames in the constructor, which didn't quite work for me.
However, "merging" the two ideas led me to the following:
a. in the constructor, store the real number of frames, and set
vi.num_frames to 1.
b. GetFrames is called only once, in its proper order (upstream
filters have run first). Use the stored real number of frames
to access all the upstream frames, print the statistics, and
then return any one frame (the last one).
That worked for me.
Thanks for the help!
- DaveA
esby
10th February 2004, 16:43
btw,
is there an textwriter plugin ?
to allow writing infos on a textfile?
(such as any stats like DaveA. was talking of)
esby
davidlallen
11th February 2004, 18:00
esby,
> is there an textwriter plugin ?
> to allow writing infos on a textfile?
> (such as any stats like DaveA. was talking of)
I hunted for one. I couldn't find one. As a programmer,
I found it wasn't too hard to write my own special purpose
filter.
- DaveA
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.