PyMedia does not parse Xing headers as of now but if you use CBR encoding
and you have only 1 stream you can calc the length of the file:
file_size/ ( bit_rate * 125 )
It will give the length of the file in seconds roughly.
Dmitry/
----- Original Message -----
From: "NeBlackCat (lists)" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, May 14, 2007 4:27 AM
Subject: [Pymedia-users] Simple question - getting song length in seconds
> I'm sure this is a stupidly trivial question, but could someone please
> tell me how you determine the length of an audio file in seconds
> (without actually playing the file)? I just can't seem to find it from
> the code & docs.
>
> The first 'stream' returned by a Demuxer's streams property (after it's
> "parse" method has been called with some data) contains a field called
> 'length', but it's always negative, eg (from a .MP3):
>
> Streams:
> ({'bitrate': 0,
> 'block_align': 0,
> 'channels': 0,
> 'frame_rate': 25,
> 'frame_rate_base': 1,
> 'height': 0,
> 'id': 86016,
> 'index': 0,
> 'length': -2077252342,
> 'sample_rate': 0,
> 'type': 1,
> 'width': 0},)
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Pymedia-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pymedia-users
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Pymedia-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pymedia-users