Doos has asked for the wisdom of the Perl Monks concerning the following question:

I want to read the the header of a mpeg frame, but I have no experience atall with binary files (except from reading the id3 tags). I want to do this without a module. Any help on how to do this is welcome.

Replies are listed 'Best First'.
(crazyinsomniac) Re: mpeg headers
by crazyinsomniac (Prior) on Mar 20, 2002 at 08:00 UTC
    Perl (and all) programming is mostly good habits, and the best good habit is knowing where to look.
    I want to do this without a module. Any help on how to do this is welcome.
    I am just baffled when I see such a statement. Doesn't CPAN still spring to mind? How can it not? (completelyl baffling).

    You also say you "have no experience atall with binary files", and still, CPAN is not the first place you look. Take hossmans advice, and go check out the CPAN module he referenced. Look inside the module, and see if you can borrow anything (whether it be code or technique).

    And lastly, you did say binary file, specifically of the mpeg format, which should tell you that you need to get the specification for that format (most of the time, everything you've already told yourself what you need, even if you may not have realized it). Check out http://www.wotsit.org for different file format specifications (I'm sure mpeg must be in there somewhere).

    Also, in case you haven't heard of CPAN, check out How to Read The Friendly Manual - it's more than just a how-to on reading the manual, it's salt to invoke the thirst for knowledge, a guide to quenching it (even if whatever question you're asking is not exactly in the manual).

    And finally, every time after you've thought up something that'd be cool to do, repeat outloud the goal you set before yourself, and a solution, or a path to one (a strategy), will surely always present it self (or at least the picture in your head will come more in focus).

    Peace! Start communication ;)

     
    ______crazyinsomniac_____________________________
    Of all the things I've lost, I miss my mind the most.
    perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

Re: mpeg headers
by hossman (Prior) on Mar 20, 2002 at 02:00 UTC
    you might try reading the source of MPEG::Info ... I have no idea what you'll find.