Hello,
what would be the easiest way to cut and join files?
I want to do this with 2 mp3-files. I do not have to decode them,
because I know exactly their bitrate/frame size, so it should be easy
to cut.
What I want is e.g. to join the last minute of file 1 with the first
minute of file 2 and create a new file.
Thank you in advance,
regards,
Susanne
Oliver Wong - 29 Jun 2006 19:09 GMT
> Hello,
>
[quoted text clipped - 6 lines]
> What I want is e.g. to join the last minute of file 1 with the first
> minute of file 2 and create a new file.
They might have ID3v2 tags which, if I understand correctly, appear at
the head of the file, and are of variable length. So you might have to do at
least some minimal decoding.
- Oliver
Susanne Kaufmann - 29 Jun 2006 20:41 GMT
I create the soundfiles by myself without any header.
Regards,
Susanne
Oliver Wong - 29 Jun 2006 21:30 GMT
>I create the soundfiles by myself without any header.
See http://mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm
While a "frame size" is constant, the frame size is the number of
samples within a frame, not its size in bytes. The encoding of the samples
varies from frame to frame to ensure a constant bit rate. 128kbps 44.1Khz
layer II uses mostly 418 byte frames, but occasionally will use a 417 byte
frame.
You can cut a mp3 file at any frame boundary, but I'm not sure you can,
for an arbitrary mp3 file, determine what byte offset to jump to to arrive
at exactly the "1 minute" point. You may have to decode, at the very least,
calculate how many samples are in 1 minute, and then jump through the file
looking for frame-synchronization markers.
- Oliver
Gordon Beaton - 30 Jun 2006 09:33 GMT
> what would be the easiest way to cut and join files?
>
[quoted text clipped - 4 lines]
> What I want is e.g. to join the last minute of file 1 with the first
> minute of file 2 and create a new file.
I don't know a lot about mp3 encoding, but you might find it
worthwhile (or discouraging) to read the LAME tech-FAQ, in particular
question 4 describing why MP3 files can't be seamlessly spliced
together (not easily anyway).
http://lame.sourceforge.net/tech-FAQ.txt
/gordon

Signature
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Andrew T. - 30 Jun 2006 10:02 GMT
> > what would be the easiest way to cut and join files?
> >
> > I want to do this with 2 mp3-files.
...
> ...you might find it
> worthwhile (or discouraging) to read the LAME tech-FAQ, in particular
> question 4 describing why MP3 files can't be seamlessly spliced
> together (not easily anyway).
(Susanne - earlier)
> ..I create the soundfiles by myself ...
Given you are creating the sound files, it may be best
to create them in a more controllable/editable format.
Have you investigated using PCM encoding?
Andrew T.
Chris Uppal - 30 Jun 2006 10:54 GMT
> (Susanne - earlier)
> > ..I create the soundfiles by myself ...
>
> Given you are creating the sound files, it may be best
> to create them in a more controllable/editable format.
> Have you investigated using PCM encoding?
Especially as it's always a good idea to postpone any use of lossy compression
until after all editing is complete.
-- chris