View Full Version : Length of a MPEG-2 File
Nic
21st January 2002, 13:49
I want to know how long (in frames or seconds etc) a MPEG-2 Movie file is with the simplest of ease (i.e. without decoding or searching through the whole file)
At present im doing it by looking at the timecode on the first Group-of-pictures & then looking at the timecode on the last GOP and working it out that way, but I doubt that's the best way of doing it...
Does any one else know a better way? Thanks alot for any help...
Cheers,
-Nic
dvd2svcd
21st January 2002, 20:34
I don't think there is a better way. I too have searched for this answer, but when I saw that Brent Beyeler does it that same way in his avi2mpg2 (searching for last frame), I gave up and said to myself that that is probably the only way to do it. But I am still not 100% sure.
Nic
22nd January 2002, 09:37
I have a small 2 min vob that has a timecode duration of about 4mins. So I dont think it's always correct & I doubt it is on Anime which is generally badly put together...
...But do you check the same thing as me (i.e. the time_code?). There must be a better way :)
Thanks for the reply, ill check out the source of avi2mpg & try a few other things.
Thanx again,
-Nic
TelemachusMH
2nd February 2002, 21:29
How exactly are you doing it now? I have been trying to get that to work for some time now, and I didn't really get any help from the forums. What do you do to find the length?
Nic
3rd February 2002, 16:59
I look at the first GOP and read the time code, then I jump towards the end of the file, & look at the last GOP and read the time code.
Try looking at bbtools, etc if im not explaing things quite correctly.
Cheers,
-Nic
meisterproppa
3rd February 2002, 22:24
Hallo
i've a qustion too,
How can i count the frames in an mpeg file with delphi...
Big thx....
Nic
3rd February 2002, 23:15
Just happened across this link, dont know if it will help you :)
http://forums.delphiforums.com/bbMPEG_UG
-Nic
meisterproppa
9th February 2002, 00:07
Hallo Nic,
No, It doesn't help,I've posted my problem but no one answer....
Is there anybody who knows an solution, how can i realize it ????
thx
Ive finally had time into looking at getting some MPEG2 file info:
try my command prompt prog:
http://nic.dnsalias.com/MPEGInfo.exe
If anyones interested in the source ill post it here....its far simpler to read that most other info retreiving code....
-Nic
mpucoder
18th July 2002, 14:37
Reading the time code at beginning and end can really mislead you, since it does not have to be correct. The SCR would be more accurate, but then you're left with the question of how many frames/second. When working with NTSC, especially mixed progressive and interlaced, you're screwed. Since MPEG is a streaming protocol, there is no header (as in, e.g. AVI). The only way to get an accurate source frame count is to scan the entire file. The method you choose, of course, will depend on just how much accuracy you need.
Thanks Mpucoder...Scanning through the whole file takes time though, so this will have to do for now. Ill look through the specs about the SCR & implement that too.
I was just bored yesterday at work in the morning & thought maybe someone could use it :)
-Nic
jj59
18th July 2002, 18:19
Maybe a bit of topic but perhaps mpeg2stat or mpeg2info can give some information.
mpeg2stat is at:
http://www.slac.com/ian/mpeg2stat.html
an article on some modifications is at:
http://citeseer.nj.nec.com/383404.html
mpeg2info is at:
http://www.cs.unc.edu/~kmp/dali_mpeg2_ext/
jj
gurpreet1989
21st February 2011, 05:15
hello
IS it possible to find total number of frames in one mpeg file And TOTAL Number of GOP in a mpeg file AND total number of frames in one GOP..........
vBulletin® v3.8.11, Copyright ©2000-2024, vBulletin Solutions Inc.