views:

1075

answers:

4

Hi,

I need to get the bit rate of a mp3 file which is being streamed as a netstream object in flash action scripting. I am using Flash Media Server 3.2.

I need the bitrate to calculate the duration of the mp3 file using the formula: Duration = file size in bytes / bitrate

+1  A: 

I'm not really sure about MP3 streaming, but it seems likely to me that the bitrate information is available as part of the metadata header. Why don't you try to define the onMetaData() method of the stream's client, and see what it contains?

Edit: Alternative idea: write a simple server side script to determine the bitrate, and query this information separately from the stream.

David Hanak
the onMetaData() method gives me the bitrate for flv and not for mp3.
renegadeMind
+1  A: 

Have you tried the NetStreamInfo class (accessible via NetStream.info)?

audioBytesPerSecond

Specifies the rate at which the NetStream audio buffer is filled in bytes per second. The value is calculated as a smooth average for the audio data received in the last second.

playbackBytesPerSecond

Returns the stream playback rate in bytes per second. The playback buffer can contain content of various playlists. This property provides the playback rate that closely matches the bit rate of the currently playing stream.

Looks like there's lots of useful info in there.

Christian Nunciato
+1  A: 

The problem is solved, the problem was with the flash player, i was using version 9, with version 10 the NetStreamInfo class does provide the bitrate for the mp3 file which was not available in version 9. Thanks a lot for all the help guys!!

renegadeMind
A: 

Please help me . Is it possiable to load M4a audio format to flash player 10 . if can how is it possiable . please explain it . send me any link .....

plz post dis as a diff question.
renegadeMind