Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read Bits of Binary Files?

Status
Not open for further replies.

breveR

Programmer
Nov 16, 2001
18
US
I need a script to be able to read certain bits of a file opened in binary mode. This is to take place on my web page.

(Host=Win2k, no PHP, custom modules or dlls)

Ok, the real reason is to be able to read the actual bits, (not bytes) that indicate what the bitrate and frequency are in an mp3 file posted on my web page, and list them on my webpage. Simply hard coding the given bitrate, frequency of the mp3 file on the page is not an option.

Ive looked into asp-vbscripts and it appears not to be possible without the aid of custom dlls (Which my host will not support)

Is this possible to do with CGI, Perl or anything else?

Thanks
 
dude, get the MP3::Info module from CPAN
you can get it here:

It'll allow you to get the following information for a MP3 file:
VERSION MPEG audio version (1, 2, 2.5)
LAYER MPEG layer description (1, 2, 3)
STEREO boolean for audio is in stereo

VBR boolean for variable bitrate
BITRATE bitrate in kbps (average for VBR files)
FREQUENCY frequency in kHz
SIZE bytes in audio stream

SECS total seconds
MM minutes
SS leftover seconds
MS leftover milliseconds
TIME time in MM:SS

COPYRIGHT boolean for audio is copyrighted
PADDING boolean for MP3 frames are padded
MODE channel mode (0 = stereo, 1 = joint stereo,
2 = dual channel, 3 = single channel)
FRAMES approximate number of frames
FRAME_LENGTH approximate length of a frame
VBR_SCALE VBR scale from VBR header


cheers!
san.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top