PDA

View Full Version : Does avisynth support variable-framerate output?


roozhou
26th April 2008, 09:42
I noticed that in mencoder there is a "near-duplicate frame remover" video filter which reduces fps in low-motion scenes. I tested this filter on encoding from anime DVD and up to 25% frames were dropped. It also resulted in 15%+ speedup in encoding(x264) and 10%+ smaller file size without quality loss. Similar option can also be found in Real Producer.

However I did not find any "drop-dup" filters among avisynth plugins. So does avisynth support VFR output? Or is there something like "null-frame" in avisynth?

J_Darnley
26th April 2008, 10:52
DeDup (http://akuvian.org/src/avisynth/dedup/) is a "drop-dup" filter that should be similar to mencoder's. and no, AviSynth says it only ouputs CFR so you need to use a time codes file, like the one produced by DeDup, to correct your frame time stamps. This is usually used when muxing the video info the final file.

roozhou
26th April 2008, 12:13
Thanks. That's what i am looking for.

BTW, should I run 1st-pass without encoding since dedup is a two pass filter?

J_Darnley
26th April 2008, 16:34
I think that's what the docs say. I have only ever given it a quick test and that was quite a while ago. Run it in something that doesn't take much processing, or resize it to ~100 px square, to generate the first pass log then run the second pass.

TheRyuu
26th April 2008, 16:35
No avisynth does not support vfr out put.

The only way to use vfr with avisynth is to have a vfrac file (variable frame rate assumed constant) with a separate timecodes file.

nonsens112
26th April 2008, 19:44
BTW, should I run 1st-pass without encoding since dedup is a two pass filter?
MeGUI's "queue analysis pass" is a good solution for 1-st pass.

roozhou
26th April 2008, 20:20
Here comes another problem.

The source is hybrid-fps (Yes, 24/30 or 24/60 hybrid-fps is quiet common for animes). I get the 1st timecode from the source and use AssumeFPS in avs.

Then some parts of the source need IVTC while other parts are progressive, so I use TIVTC in avs and get the 2nd timecode.

Now I add DeDup in avs and thus I got the 3rd timecode.

How can i "merge" these three timecode files to one and generate the final video with correct fps and duration?

nonsens112
26th April 2008, 20:38
How can i "merge" these three timecode files to one and generate the final video with correct fps and duration?
like this:

decimation pass1 (analysis):

AviSource("source.avi")

TFM(mode=1,output="source-tfm.txt")
TDecimate(mode=4,output="source-stats.txt")

decimation pass2:

AviSource("source.avi")

oldcount=framecount
oldfps=framerate
TFM(mode=1)
TDecimate(mode=5,hybrid=2,dupthresh=1.0,input="source-stats.txt",tfmin="source-tfm.txt",mkvout="source-decimated.tmc")
averagefps=(float(framecount)/float(oldcount))*oldfps
assumefps(averagefps)

dedup pass1 (analysis):
AviSource("source-decimated.avi")

DupMC(log="source-decimated-dup.txt")

dedup pass2:
AviSource("source-decimated.avi")

oldcount=framecount
oldfps=framerate
DeDup(threshold=0.15, threshold2=0.25, range2=2, maxcopies=6, maxdrops=3, timesin="source-decimated.tmc", log="source-decimated-dup.txt", times="source-final.tmc")
averagefps=(float(framecount)/float(oldcount))*oldfps
assumefps(averagefps)

but dunno about TIVTC, never used it.

roozhou
26th April 2008, 21:21
Where is "source-decimated.avi" from?
Is that a big temp file?

nonsens112
26th April 2008, 21:32
Where is "source-decimated.avi" from?
Is that a big temp file?
hmm... I always use big temp files, but I think using output of 2-nd TDecimate pass instead of AviSource("source-decimated.avi") should work.

the thing is that using dedup before denoisers is ineffective qualitywise, and using after (w/o temporary intermediate files) - ineffective speedwise, because processing is repeated each pass.

I always use MVDeGrain3 after TDecimate and before DeDup, for example.

roozhou
26th April 2008, 22:02
Thanks anyway.
IMO using temporal denoiser before DeDup would have more frames removed.