Search code examples
c++audiomp3

How to cut MP3 without re-encoding? Should i just copy the frames?


I need to implement a feature that could transmit parts of a large mp3 file over the TCP/IP in a way that would allow user to listen each part without having the entire file (using libmpg123). I would like to allow users to transmit parts as small as possible without re-encoding the stream. I would like to forget about re-encoding, because i don't want sound quality to degrade with each transmission. Each time i want to cut mp3 i do have the splitting coordinates in samples: "from what sample to what sample", so each time i should translate this to an IDs of an mp3-frames. So my question is:

  • Does each mp3 frame has enough information (bps/samplerate/bits-per-sample/channels) to play it without entire mp3-file header just by feeding them to an mp3 decoder?
  • Is there any BSD/MIT-licensed small library that could work as mp3 splitter using samples-coordinates and supporting VBR?

Solution

  • You can just cut binary file! The only problem of this solution... problem with Tags

    Or try this: http://www.codeproject.com/Articles/8295/MPEG-Audio-Frame-Header