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 Search this Thread Display Modes
Old 16th December 2011, 17:06   #1  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 791
Which *source filter is the most suitable?

Hi I need this answer for my batcher but I decided to put it in special thread:

There are many diferent source filters (AviSource, MPEG2Source, MPEGDecoder, FFSource...).
There are media files, which can be opened only with one of them. But there are many which can be opened with more then one and then, which one to choose.

I don't know what can be the criteria but what comes to me now is (more or less sorted by importance):
- assuring audio sync
- framerate keeping (sometimes I had MPEG2Source with double framerate result with every other frame full green)
- interlaced processing ???
- postprocessing options
- some color conversion errors?
- frameacurate seeking
- ...

I know it depends on 1) codec 2) container. I also know that file extension does not necessarily imply the container.
But, it already happened to me, that file *.vlc got error when opening and when I renamed it to *.avi, all went fine.


Same goes for audio. Has maybe demuxing some benefit on a/v sync?


In my batcher I, at this moment, try first FFVideoSource and when error I try AviSOurce. I plan to introduce more filters, but first I want to be sure to make it correctly.


So, can anyone with knowledge in this area, put down some basic rules, which should a user follow to choose best source filter?
redfordxx is offline   Reply With Quote
Old 16th December 2011, 17:10   #2  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 791
Maybe, we can put together some general purpose table like this:
Code:
Container 	MP4		MKV		MPEG2-PS	AVI		WMV	
AVC		FFMS		FFMS		-
XViD,DivX	FFMS		FFMS				AviSource


Typical extensions
AVI		= *.avi, *.divx, ...
MPEG2-PS	= *.vob, ...
WMV		= *.wmv, *.wm, ...

Last edited by redfordxx; 16th December 2011 at 17:28.
redfordxx is offline   Reply With Quote
Old 16th December 2011, 18:02   #3  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,073
TS/PS: dgindex and friends
Pretty much everything else: FFMS
Backup for stuff not supported properly by FFMS: AVISource/DSS(2)/various source-specific plugins (qtsource etc)
Raw image data: rawsource/sashimi

AVISource and DSS(2) are extremely unreliable from an "automagic" perspective, since their capabilities are completely dependent on third-party software that may or may not be installed on the user's system. AVISource in particular can often be a correct choice for AVI's, but you can't rely on that without knowing what the user's VFW environment looks like, so for automatic programs you distribute to random users it's very unsuitable as a general-purpose source filter.
TheFluff is offline   Reply With Quote
Old 16th December 2011, 19:19   #4  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 791
So, what you are saying if it is MPEG2, it is better to use DGIndex and friend than FFMS, even if FFMS can read the file?
So, can I put it like this? Even when the extension suggests that it is not MPEG2, still try it:
Code:
try{MPEG2Source(*.whateverextension)}
catch(errmsg){FFVideoSource(*.whateverextension)}
(the trying does not make sense in some obvious cases but it is easier to code than testing various file extensions)
Are there any important about the and friends area? For example I understand MPEGDecoder does not require indexing, which would be good for my "automagic" stuff. However are there any disadvantages?

Last edited by redfordxx; 16th December 2011 at 19:26.
redfordxx is offline   Reply With Quote
Old 16th December 2011, 21:06   #5  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
Quote:
Originally Posted by redfordxx View Post
So, can I put it like this? Even when the extension suggests that it is not MPEG2, still try it:
Code:
try{MPEG2Source(*.whateverextension)}
catch(errmsg){FFVideoSource(*.whateverextension)}
Mpeg2Source takes a .d2v index file which is generated by DGIndex.
AVCSource takes a .dga index file which is generated by DGAVCIndex.
So blindly trying to open random files won't work.

Indexing is suppose to make random-seeking frame-accurate.
FFMS support for transport/program streams is done through haali/directshow and seeking could be off by a frame or two. (not indexed??)
gyth is offline   Reply With Quote
Old 16th December 2011, 21:45   #6  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 791
My bad.
I meant try{indexing} and if not OK, do it with FFMS.

And what would be good recomendation for wmv? I must say this is where I experienced mostly a/v sync problems.
I had one file (now deleted) where avisynth detected framerate somewhere around 29 and in fact it was 30fps, so the result was out of sync. (basically this is why I added framerate warning to the batcher)

Last edited by Guest; 16th December 2011 at 21:50. Reason: rule 12: don't ask for best
redfordxx is offline   Reply With Quote
Old 16th December 2011, 22:03   #7  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Quote:
I meant try{indexing} and if not OK, do it with FFMS.
You should be able to do this with the MpegAutoIndexSource function, like:

Code:
try{MpegAutoIndexSource("foo.xyz")}
catch(errmsg){FFVideoSource("foo.xyz")}
Quote:
And what would be good recomendation for wmv?
As for .wmv files, I have had luck with the Nvidia version of neuron2's tools, which has VC1 support, providing that you demux the video first (which gets handled automatically by MpegAutoIndex). I can't say this works for all .wmv files, however. Note that in order to use the NVidia version, you need a license from neuron2 and must set MpegAutoIndexSource(nv=true). VC-1 only works with that version of the indexer.

Last edited by vampiredom; 17th December 2011 at 01:57. Reason: fixed the erroneously swapped CODE and QUOTE tags
vampiredom is offline   Reply With Quote
Old 16th December 2011, 22:35   #8  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 791
NVidia...is it related to hardware? Do I have to have NVidia GPU or something, or it is just name?
redfordxx is offline   Reply With Quote
Old 17th December 2011, 00:38   #9  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Quote:
NVidia...is it related to hardware? Do I have to have NVidia GPU or something
Yes, it requires a CUDA-capable card from Nvidia, unfortunately. Neither DGIndex, DGAVCIndex nor the DiAVC version support VC-1. I can't say say that the NV version is the "best" (for fear of being slapped down by the old rule #12 deal) but it is the most versatile, format-wise, of all neuron2's indexer/decoder versions.

Last edited by vampiredom; 17th December 2011 at 00:50.
vampiredom is offline   Reply With Quote
Old 17th December 2011, 01:47   #10  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,384
Quote:
Originally Posted by vampiredom View Post
I can't say say that the NV version is the "best" (for fear of being slapped down by the old rule #12 deal)
As far as I can see, the rule only forbids asking what's best, not saying what you think is best.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 17th December 2011, 03:28   #11  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 791
Quote:
Originally Posted by vampiredom View Post
Yes, it requires a CUDA-capable card from Nvidia, unfortunately. Neither DGIndex, DGAVCIndex nor the DiAVC version support VC-1. I can't say say that the NV version is the "best" (for fear of being slapped down by the old rule #12 deal) but it is the most versatile, format-wise, of all neuron2's indexer/decoder versions.
Well, last time I checked, I don't have such stuff stuffed in my notebook.
But, this VC-1, it is bluray codec, isn't it? So, I don't expect it in batch encoding often. Or, am I mistaken?
redfordxx is offline   Reply With Quote
Old 17th December 2011, 05:50   #12  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Quote:
Well, last time I checked, I don't have such stuff stuffed in my notebook.
Yeah, I know. Not everybody has a compatible video card, which is a shame. DGDecodeNV really does work very well with a great many sources.
Quote:
Well, last time I checked, I don't have such stuff stuffed in my notebook.
I don't really know what batches you are running If you are batching stuff from VC-1 BluRay, then… Bob's your uncle.

You asked about .wmv files: Some ".wmv" files are WVC1 (VC-1) while others are WMV3 (Windows Media 9). I don't really know all the gory details about these containers and how they differ and their compatibility. I only know that the process I described will work with the bona fide VC-1 ones, not the WMV3 ones.

[At the risk of drifting off-topic, I would love to find a simple command-line way of losslessly converting/rewriting WMV3 -> WVC1, if such a thing is possible]
vampiredom is offline   Reply With Quote
Old 17th December 2011, 20:22   #13  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,073
Quote:
Originally Posted by redfordxx View Post
And what would be good recomendation for wmv? I must say this is where I experienced mostly a/v sync problems.
I had one file (now deleted) where avisynth detected framerate somewhere around 29 and in fact it was 30fps, so the result was out of sync. (basically this is why I added framerate warning to the batcher)
In general, you cannot rely on the framerate reported by Avisynth. Many containers (including WMV) support VFR, and then the reported framerate is completely meaningless (since Avisynth isn't even aware VFR exists).
TheFluff is offline   Reply With Quote
Old 17th December 2011, 20:27   #14  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 791
And what would be the advice on videos, where the audio sync off and changing sometimes positive, sometimes negative. I believe it it means the source is vfr?
For example avc in flv?

With ffms is audio sync off, DSS says the filter graph manager won't talk to me and when I playback it in BS, it is fine with FLVsplitter+CoreAVC.

First wondering is already that DSS makes problems... I thought that when I can play the video in BSPlayer, it automatically works with DSS...
Any ideas?

This makes sync problems:
Code:
FFVideoSource(srcfile, threads=1)
This won't talk to me:
Code:
DirectShowSource(srcfile, audio=false, pixel_type="YV12", logfile="ds.log", logmask=-1)

Last edited by redfordxx; 17th December 2011 at 20:31.
redfordxx is offline   Reply With Quote
Old 18th December 2011, 08:33   #15  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,073
Quote:
Originally Posted by redfordxx View Post
And what would be the advice on videos, where the audio sync off and changing sometimes positive, sometimes negative. I believe it it means the source is vfr?
For example avc in flv?
There are only two options:
1) enforce CFR (fpsnum/fpsden parameters to ffms2, convertfps parameter for DSS)
2) export timecodes from the original file and add them back in when muxing.
TheFluff is offline   Reply With Quote
Old 20th December 2011, 01:42   #16  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 791
Hi, I am trying to use MPEGAutoIndex and I am confused about one thing. For example in the log file is Aspect Ratio: 4:3 NTSC but when I open it in MeGui, it reports 1,367521 which is clearly not 4/3. Similarily 16:9 versus 1,823361 (and 1,823169 ???)
Can anyone explain how these standards work?
redfordxx is offline   Reply With Quote
Old 21st December 2011, 18:29   #17  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 791
So I did some research and I am even more confused. I realized that e.g. 16:9 is "just a name" and one must know other info about the source to be able to choose correct AR. And that's where I am lost
At the moment I have found 3 types of SAR for 16:9 MPEG2
Code:
PAL	512:351		118:81		64:45
NTSC	5760:4739	40:33		32:27
But I don't know which one when to use.

Then MPEG1... maybe is not the case and Aspect ratio which I can read in the logfile is really the one, or I have also to find the correct one somewhere else.
I read somewhere that MPEG1 has 14 aspect ratios, so I hope they are directly the ones
For example 4:3,625, which I remember from some DGIndex logfile.

Thanx to anyone for any enlightening.
R.
redfordxx is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 23:07.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.