Re: ASF - WMA header

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Sat, 10 Dec 2005 22:00:37 +0100, "Alessandro Angeli
[MVP::DigitalMedia]" <nobody@xxxxxxxxxxxxxxxxxx> wrote:

>Neil Smith [MVP Digital Media] wrote:
>
>> Somebody was asking about this in another group for
>> file-reading using PHP (and I didn't know). Is there
>> anything documented to read the ASF [binary] data and
>> extract the media duration from that ?
>>
>> Or is there a text string which is embedded somewhere
>> that can be used ?

Answers own question : Nope, there are various title, version and
other metadata but no recognisable text strings for this.

>The duration is written in an unsigned 64-bit integer in the
>HeaderObject/FilePropertiesObject::PlayDuration field. See
>section 3.2 of the ASF specification on
>www.microsoft.com/asf.

Thanks Alessandro, I'll have another look at that doc. If the
attribute value was in a fixed position within the header it would be
easy to find, however I have a feeling it can be at a variable
position within the first few hundred bytes of the asf.

>I am no PHP expert, but since PHP is a child of Perl, you

Consider it a "nephew" rather than "child" ;-)

>should be able to read a binary file and thus parse it

True, and that's what I'm kind-of-hoping.

>according to the ASF syntax. If the PHP code is run on
>Windows and the PHP runtime has the same capabilities of
>ActivePerl, there is a COM/ActiveX module that should allow
>the use of the WMF SDK. Parsing the file may be easier than
>using this Perl module.

I suggested the COM extensions to the OP (again, if on windows),
though that would possibly require loading the entire of WMP (plus the
file) to read the file's duration. Not too sure how to instantiate the
WMF COM object - though I figure I can get to the WMP object easily
enough, it could be overkill.

If I can find a good way to read the asf header directly to extract
the duration, then only the first few kb of the file need be loaded
and parsed, which gives a much lower overhead.

Cheers for that - Neil
.



Relevant Pages

  • Re: Get Duration of a Windows Media File from the hex output
    ... >I wanted to get the duration of a Windows Media file with PHP on the server ... >Quicktime has an atom format that you pull a variety of information from ... >with PHP. ... >Does Windows Media have something similar? ...
    (microsoft.public.windowsmedia)
  • Re: Migration
    ... migration of a PHP project to Java /J2EE .My focus will be explaning ... developers as compare to duration spent on PHP .Do anyone have any ...
    (comp.lang.php)
  • Re: Get Duration of a Windows Media File from the hex output
    ... >I wanted to get the duration of a Windows Media file with PHP on the server ... If you were running your PHP on IIS, ... How do you query a Quicktime file for that value with PHP, ...
    (microsoft.public.windowsmedia)
  • Re: Please help me find my problem !!!
    ... > basic grasp of PHP somewhat quickly, already have a completed login ... extract(), as ... Tom Thackrey www.creative-light.com tom creative light com do NOT send email to jamesbutler@willglen.net ...
    (comp.lang.php)
  • Re: Idea for PHP Enhancement: register_globals_manual
    ... > Your comment says the same thing I'm saying: that using extract has the ... now support all of the super globals in PHP. ... of the superglobal array to play with. ...
    (comp.lang.php)