(this is a repost - last one got mixed up - apologies! :-) )
Hello all - I am new to PyMedia (but not Python) and it seems great, but
I am having trouble doing something very basic - simply opening a FLAC
file and get its length in seconds and metadata.
Here is my annotated test code, which I just cant get to work on a
completely valid flac file (which PyMedia test apps can play no problem):
-----------------------------------------------
f = open("test.flac", 'rb')
s = f.read()
dm = pymedia.muxer.Demuxer('flac')
frames = dm.parse(s)
frame = frames[0]
dec= pymedia.audio.acodec.Decoder(dm.streams[0] ) (*1)
if dec != None:
r= dec.decode( frame[1] ) (*2)
pprint(dm.getHeaderInfo()) (*3)
print r.sample_rate, r.channels
f.close()
-----------------------------------------------
The problems (see code annotations) are:
(*1) dm.streams[0] contents dont seem to be entirely sensible:
index=0
block_align=0
type=1
frame_rate_base=1
height=0
channels=0
length=-2077252342
sample_rate=0
frame_rate=25
bitrate=0
id=86031
(*2) r returns as None. frame[1] does seem to have sensible data in
(it's the start of the flac file: "
fLaC\x00\x00\x00"\x12\x00\x12\x00\x00\x00\x0E\x00....")
(*3) getHeader info returns no values in the metadata dictionary, even
though I know the FLAC file has them in (in Ogg style).
Hugely grateful of any help - this is doing my head in!!
-------------------------------------------------------------------------
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