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. |
|
|
#1 | Link |
|
Moderator
![]() Join Date: Oct 2001
Location: England
Posts: 3,260
|
Length of a MPEG-2 File
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 |
|
|
|
|
|
#2 | Link |
|
Moderator
Join Date: Oct 2001
Location: On top of the world!
Posts: 1,837
|
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.
__________________
Cheers, dvd2svcd |
|
|
|
|
|
#3 | Link |
|
Moderator
![]() Join Date: Oct 2001
Location: England
Posts: 3,260
|
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 |
|
|
|
|
|
#4 | Link |
|
Just a kid at heart
Join Date: Oct 2001
Location: Wouldn't you like to know ;-)
Posts: 272
|
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?
|
|
|
|
|
|
#5 | Link |
|
Moderator
![]() Join Date: Oct 2001
Location: England
Posts: 3,260
|
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 |
|
|
|
|
|
#7 | Link |
|
Moderator
![]() Join Date: Oct 2001
Location: England
Posts: 3,260
|
Just happened across this link, dont know if it will help you
![]() http://forums.delphiforums.com/bbMPEG_UG -Nic |
|
|
|
|
|
#9 | Link |
|
Moderator
![]() Join Date: Oct 2001
Location: England
Posts: 3,260
|
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 |
|
|
|
|
|
#10 | Link |
|
Moderator
![]() Join Date: Oct 2001
Posts: 3,398
|
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.
|
|
|
|
|
|
#11 | Link |
|
Moderator
![]() Join Date: Oct 2001
Location: England
Posts: 3,260
|
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 |
|
|
|
|
|
#12 | Link |
|
Registered User
Join Date: Dec 2001
Posts: 61
|
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 |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|