Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Detection of mp3-bitrate (format)

Posted on 1999-06-22
2
Medium Priority
?
605 Views
Last Modified: 2008-02-26
I need to write an app that allows to change the bitrate of mp3-files. I read the file, convert it to PCM and convert it back to mp3 with a different bitrate (sometimes I have to do a PCM-PCM-conversion if the sample-rate changes).

The only problem: I'm not able to detect the source-format (bitrate) of the mp3-source-file. How can I do this?

I'm working with ACM and I have to specify the source-format when calling acmStreamOpen.
0
Comment
Question by:joker1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 800 total points
ID: 1198177
You can find the bitrate in the header:

Mpeg 1.0/2.0 LayersI, II and III header and trailer formats
-----------------------------------------------------------

Laurent.Clevy@alcatel.fr



* HEADER


bits name              comments
--------------------------------------------------
12   sync              0xFFF
1    version           1=mpeg1.0, 0=mpeg2.0
2    lay               4-lay = layerI, II or III
1    error protection  0=yes, 1=no
4    bitrate_index     see table below
2    sampling_freq     see table below
1    padding
1    extension         see table below
2    mode              see table below
2    mode_ext          used with "joint stereo" mode
1    copyright         0=no 1=yes
1    original          0=no 1=yes
2    emphasis          see table below
--------------------------------------------------

- bitrate_index

. mpeg1.0

            1  2  3   4   5   6   7   8   9  10  11  12  13  14
layer1     32 64 96 128 160 192 224 256 288 320 352 384 416 448
layer2     32 48 56  64  80  96 112 128 160 192 224 256 320 384
layer3     32 40 48  56  64  80  96 112 128 160 192 224 256 320

. mpeg2.0

            1  2  3   4   5   6   7   8   9  10  11  12  13  14
layer1     32 48 56  64  80  96 112 128 144 160 176 192 224 256
layer2      8 16 24  32  40  48  56  64  80  96 112 128 144 160
layer3      8 16 24  32  40  48  56  64  80  96 112 128 144 160


- sampling_freq

. mpeg1.0

    0     1     2    

44100 48000 32000

. mpeg2.0

    0     1     2    

22050 24000 16000


- mode:

0 "stereo"
1 "joint stereo"
2 "dual channel"
3 "single channel"


- mode extension:
 
0      MPG_MD_LR_LR
1      MPG_MD_LR_I
2      MPG_MD_MS_LR
3      MPG_MD_MS_I

jsbound :

   mode_ext     0  1   2   3
layer
1               4  8  12  16
2               4  8  12  16
3               0  4   8  16


- emphasis:

0 "none"
1 "50/15 microsecs"
2 "reserved"            must not be used !
3 "CCITT J 17"




* TRAILER

at end of file - 128 bytes

offset  type  len   name
--------------------------------------------
0       char  3                   "TAG"
3       char  30    title
33      char  30    artist
63      char  30    album
93      char  4     year
97      char  30    comments
127     byte  1     genre
--------------------------------------------

- genre :

<snipped out>

- frame length :

. mpeg1.0

layer1 :
 (48000*bitrate)/sampling_freq + padding
layer2&3:
 (144000*bitrate)/sampling_freq + padding

. mpeg2.0

layer1 :
 (24000*bitrate)/sampling_freq + padding
layer2&3 :
 (72000*bitrate)/sampling_freq + padding

(This explanation can be found at 'http://www.wotsit.org/cgi-bin/search.cgi?music' ;-)
0
 

Author Comment

by:joker1
ID: 1198178
Thanks!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question