Log in

View Full Version : Determine video length in frames or time


quantum
13th September 2003, 22:14
How can I determine the video length, in frames and time, via code for an AVS that points to an M2V file?

KpeX
13th September 2003, 23:37
http://www.avisynth.org/index.php?page=ClipProperties

FrameCount() should work if I understand your question correctly, otherwise use with FrameRate() to get time. i.e. Framecount()/Framerate()=length in seconds

quantum
14th September 2003, 01:18
I mean for a stand-alone application in C++ or VB, not in an AVS script which would then have to be interpreted by an application such as virtualdub. Unless there is a way to output results from an AVS script to the command line using a utility that I'm not aware of.

jonny
15th September 2003, 10:31
The call sequence is something like this:

AVIFileInit
AVIFileOpen
AVIFileInfo
AVIFileRelease
AVIFileExit

With AVIFileInfo you get all the info you need.
PS: using vfw there is (almost) no difference between avs & avi files.
PPS: you could take a look at avs2avi sources too...

quantum
15th September 2003, 18:15
Thanks, that points me in the right direction. I found some samples to get me started.