Scanning a file

David Rasmussen david.rasmussen at gmx.net
Tue Nov 1 14:35:07 EST 2005


Lasse Vågsæther Karlsen wrote:
> David Rasmussen wrote:
> <snip>
> 
>> If you must know, the above one-liner actually counts the number of 
>> frames in an MPEG2 file. I want to know this number for a number of 
>> files for various reasons. I don't want it to take forever.
> 
> Don't you risk getting more "frames" than the file actually have? What 
> if the encoded data happens to have the magic byte values for something 
> else?
> 

I am not too sure about the details, but I've been told from a reliable 
source that 0x00000100 only occurs as a "begin frame" marker, and not 
anywhere else. So far, it has been true on the files I have tried it on.

/David



More information about the Python-list mailing list