View Full Version : Changing sample rate from 44.1 to 48 Khz in MP3 file header
mrbruno
10th October 2004, 08:39
hi !
I've got mp3 files with a wrong sample rate in header
(44.1 instead of 48)... As a result, they are not played
at their original speed.
I need to change the sample rate from 44.1 to 48.
Of course, I could decode them then re-encode them...
But I'd prefer just to edit the MP3
file header.
Is there a program to do that ?
I've searched everywhere but I never found such
a software...
Please help !
Thanks
fccHandler
10th October 2004, 20:38
I don't think that would work. The sample rate field affects the frame sizes of the compressed data, and if you change it, players won't be able to parse the MP3.
Unfortunately, decoding and re-encoding is the only way.
stephanV
10th October 2004, 21:13
Originally posted by mrbruno
But I'd prefer just to edit the MP3
file header.
also, there is no such thing as an MP3 file header... each frame has its own header. but as fcc said, changing that would not make sense, youd only get garbled output (if it doesnt crash the decoder to begin with).
fccHandler
11th October 2004, 02:25
You know, on second thought it might actually be possible to do. The sample rate affects the frame size (and rate), but does it affect anything else about the compression? Could you separate the raw compressed data from the bitstream info, create new headers, then repackage the whole thing without disturbing the compressed audio samples?
stephanV
11th October 2004, 11:11
no, i dont think it would work.
say we have a frame which has a rate of 128 kbps at 44.1 kHz
the frame size would then be 144*128/44.1 = 417 bytes (no padding)
if we change the sample rate to 48 kHz we would have to adjust the bit rate too, otherwise the whole frame wouldn't be read out (a 48 kHz is shorter in time than a frame at 44.1 kHz)
the new bit rate becomes then 417*48/144 = 139 kbps
problem is: there's no way to store this bit rate in the frame header.
so no, don't think it would work.
Pyscrow
11th October 2004, 11:48
Originally posted by stephanV
also, there is no such thing as an MP3 file header... each frame has its own header. but as fcc said, changing that would not make sense, youd only get garbled output (if it doesnt crash the decoder to begin with).
Actually there is a header of sorts in MP3's it is the ID tag. In version 1 at the start of the mp3, in version 2 at the end. But as far as I am aware the Khz is not in either.
stephanV
11th October 2004, 11:56
No thats not a header, thats junk data. ID3 isnt mentioned anywhere in the MP3 specs and certainly isnt mandatory for it. A decoder doesnt need that information. In principle i think you could give every type of file a ID3 tag.
johnman
11th October 2004, 22:11
i was bored so i just tried it..... i changed the header of all frames (8000 of them) from 44khz to 48 khz and it became an invalid (= unrecognized) mp3 . As was mentioned before.... this is probabely because of the framesize.
stephanV
11th October 2004, 22:55
told you so :p
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.