Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Display Modes
Old 4th March 2005, 00:23   #1  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 5,616
DirectShowSource and VFR

Someone modified DSS (as external plugin) to properly handle VFR in some way. I haven't looked at it, so I'm not really sure how it works yet ...

Quote:
The DirectShowSource source filter for AviSynth is very useful and powerful: it can read most formats that Windows Media Player supports. The filter enable us to convert, into other formats, Windows Media Video (WMV), Advanced Systems Format (ASF), Real Media (RM) files, etc. which are not supported by VirtualDub (RealMediaSpliter is necessary for reading RM files).

However, current DirectShowSource source filter has a weak point: it cannot handle video streams which use Variable Frame Rate (VFR). Some codecs such as WMV and RM employ VFR technique for higher compression. It causes problems to read VFR files with DirectShowSource, but we have no way to read such files with AviSynth.

The root of this problem is that frame rate of a source stream is variable although AviSynth only supports constant frame rate. It turns out that the problem will be solved only if the DirectShowSource source filter output a proper frame for a given frame number.

"DirectShowSource with ConvertFPS" is a patch to the official DirectShowSource filter to add a routine for frame rate conversion: it determines the position of the #n frame base on media time information and therefore forces to handle VFR files properly.
http://nyaochi.sakura.ne.jp/xoops/mo...oads/index.php
Wilbert is offline   Reply With Quote
Old 4th March 2005, 08:04   #2  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 908
It looks like an easy way to convert a vfr stream to a cfr stream. Say if you have a vfr file that has a mix of 29.970 and 23.976 it can convert it to 119.88 fps cfr by using directshowsource("file",fps=119.88,convertfps=true). It will duplicate frames in the 23.976 sections 5 times and frames in the 29.970 sections 4 times. Previously you would have had to extract the timecodes separately and then use trim() statements to apply changefps() on each section with a different fps, at least for vfr mkv files.
tritical is offline   Reply With Quote
Old 4th March 2005, 16:23   #3  |  Link
sh0dan
AviSynth Developer
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,469
Looked through the patch, and it seems rather safe to apply and include this in the AviSynth distribution.
__________________
Regards, sh0dan // VoxPod
[AviSynth 2.5 project page] | [blog].
sh0dan is offline   Reply With Quote
Old 4th March 2005, 23:49   #4  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 5,616
Forgive me my ignorance. How do I make those 120 fps?

I got a mkv_vfr somewhere (the famous startrek one), but if I encode straight to XviD (using that modified DSS), I get indeed a clip of 119.88 fps.

But if I play it in WMP or Zoomplayer it plays at ~75 fps (instead of 23.976 and 29.97). So, it doesn't seem to drop frames. Should I use some special setting when setting up the encoder?
Wilbert is offline   Reply With Quote
Old 5th March 2005, 14:55   #5  |  Link
lamer_de
Member
 
lamer_de's Avatar
 
Join Date: Dec 2001
Location: somewhere far beyond
Posts: 267
Quote:
Forgive me my ignorance. How do I make those 120 fps?
There's some sort of explanation on how tocreate them in this thread:
http://forum.doom9.org/showthread.ph...ighlight=avi60
You need avi60 and some other tools. Most of the documentation is only available in Japanese, though. You definitely can't feed a 120fps stream to vdub and expect it to drop frames on its own.

CU,
lamer_de
lamer_de is offline   Reply With Quote
Old 5th March 2005, 15:50   #6  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 5,616
Quote:
You need avi60 and some other tools. Most of the documentation is only available in Japanese, though. You definitely can't feed a 120fps stream to vdub and expect it to drop frames on its own.
Ok, I tried this succesfully.

So how do you use this modified DSS to convert mkv+vfr to something else (meaning mkv_vfr or avi_120+drop_frames)?
Wilbert is offline   Reply With Quote
Old 5th March 2005, 16:32   #7  |  Link
lamer_de
Member
 
lamer_de's Avatar
 
Join Date: Dec 2001
Location: somewhere far beyond
Posts: 267
As far as I understood it, you don't. It's meant to convert vfr to cfr.
So you use dss to get a "true" 120fps stream and decimate that down to 23.976 or 29.970 (or whatever framerate most of the content is in).

Before the patch, dss would always deliver all frames sequentially and therefore messing up the timecodes. So if you entered 120fps before, it would give you 120 different frames, which would've resulted in a 5xspeedup (assuming most of the source was 24fps, as dss skips the dropframes). At the same time, it would've kept the times from the original source though, so after 1/5th of the time, you only get the last frame feed to vdub. This makes a decimation impossible. Now it gives you 1 frame plus 4 duplicates. (At least that's the way I understood it, I hadn't had time to try this patched dss yet)

I hope I got this point across, kinda hard to describe

CU,
lamer_de
lamer_de is offline   Reply With Quote
Old 5th March 2005, 17:24   #8  |  Link
AS
Registered User
 
Join Date: Jan 2002
Posts: 76
Actually, in this case, there wouldn't so much as in duplicates but in blended frames, as it is done with ConvertFPS rather than ChangeFPS; this would actually give you "new" frames.

A DSS with ChangeFPS would be better and more ideal.

What this does is making vfr source much more usable with less hassle. Previously it would require you to identify and trim out the different sections, make them into the same framerate and feed a cfr into vdub. Now it removes the first (two) steps (ChangeFPS would be much better in this aspect).
AS is offline   Reply With Quote
Old 5th March 2005, 19:15   #9  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 5,616
Quote:
Actually, in this case, there wouldn't so much as in duplicates but in blended frames, as it is done with ConvertFPS rather than ChangeFPS; this would actually give you "new" frames.
Hmmm. So, that's the reason that everything is detected as non-film (after decimation)?
Code:
DirectShowSourceVFR_DirectShowSource("F:\Guides\Hybrid\vfr_startrek.mkv", fps=119.88, convertfps=true)
Decimate(4).Decimate(3).Decimate(2)
Decomb521VFR_Decimate(mode=4, threshold=1.0, progress=true, timecodes="F:\Guides\Hybrid\timecodes2.txt", 
vfrstats="F:\Guides\Hybrid\video.vfrstats", show=true)
It doesn't work anyway, when playing this (with show=false) it is stuck after 99%.

Quote:
A DSS with ChangeFPS would be better and more ideal.
I have no idea how to do that. Perhaps Sh0dan can look at this?
Wilbert is offline   Reply With Quote
Old 5th March 2005, 21:02   #10  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 908
lamer_de is correct. Also, this patch doesn't actually use any internal function (changefps or convertfps). convertfps is just the name of the parameter the person added. The method comes out acting like changefps, i.e. there are no blends.
tritical is offline   Reply With Quote
Old 6th March 2005, 08:48   #11  |  Link
AS
Registered User
 
Join Date: Jan 2002
Posts: 76
Quote:
Originally posted by tritical
convertfps is just the name of the parameter the person added. The method comes out acting like changefps, i.e. there are no blends.
Ah, marvelous

This tells me to test the plugin before making a fool of myself next time.
AS is offline   Reply With Quote
Old 18th July 2006, 12:33   #12  |  Link
thuongshoo
Registered User
 
Join Date: Mar 2006
Posts: 197
I read VFR page on AviSynth-wiki's site.
http://www.avisynth.org/mediawiki/wi...FrameRateVideo
I also read as "TIVTC Common Usage Examples.txt" says
pass 1
DirectShowSource("c:\video.wmv", fps = 30 , audio= false , convertfps = true )
tfm(output="matches.txt")
tdecimate(mode=4,output="metrics.txt")
Run this pass by Megui

pass 2
DirectShowSource("c:\video.wmv", fps = 30 , audio= false , convertfps = true )
tfm(input="matches.txt")
tdecimate(mode=5,hybrid=2,vfrDec=1,input="metrics.txt",tfmIn="matches.txt",mkvOut="mkv-timecodesfile.txt")

Encode by Megui
For MPEG file , I add "d2v=.." for tfm .
If I do like this, Will I have a VFR video ?
thank you !

Last edited by thuongshoo; 18th July 2006 at 12:36.
thuongshoo is offline   Reply With Quote
Old 18th July 2006, 13:08   #13  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Oceanborn
Posts: 7,607
Unless the wmv is telecined, you don't need tfm though, so you can leave out tfmin from tdecimate. Did I write that? >.> Oh no, good, but I did forget input="tfm.txt", thanks. Usually you'd only use tfm for mpeg-2 and the occasional interlaced xvid.

You might want to check if the wmv is 29.97 or 30fps, it's not huge but it makes a small difference.

Otherwise yes! Remember that these aren't encoding passes though, you have to run 1st and 2nd encoding pass both off the second avisynth script.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. ~ Ed Howdershelt
foxyshadis is offline   Reply With Quote
Old 19th July 2006, 07:05   #14  |  Link
thuongshoo
Registered User
 
Join Date: Mar 2006
Posts: 197
The Wiki guide only discuss about 24/30-material . Some MV are blend by 15 fps and 8 fps . I want to have a method for all case . Actually I don't use above scripts .

At the first, I use MEgui to analyse my MV(wmv, mpeg,....)
And then, I insert these Avisynth commnand into script which is created by Megui. So I sure that MV is inverse-telecined if this thing is necessary .....
thuongshoo is offline   Reply With Quote
Old 19th July 2006, 13:00   #15  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Oceanborn
Posts: 7,607
TIVTC only works well on 24/30 hybrid, or 24/30 in 120. If it's anything other than a 1-in-5 decimation, TIVTC doesn't support it, nor does decombvfr to the best of my knowledge. (It's too bad, I'd love it to identify patterns to eliminate judder entirely.) Dedup won't shift frame times, although it'd be a very cool mod if I could figure out how to do it.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. ~ Ed Howdershelt
foxyshadis is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 20:44.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.