MPEG Cut Utility

Release: 0.1

→ description → usage → download → history → todo → contact

Description

This utility copies frames from an MPEG-1, MPEG-2 or MPEG-2.5 audio stream compressed with Layer I, II or III into new files. Splitmp3 is optimized operate on very large files in the order of 1GB and more and transient MPEG streams.


Usage guide

Installation

Copy the executable somewhere to your hard drive. You must have the gcc 3.3.5 runtime (libc06b5.dll) somewhere in your LIBPATH.
Create a program object for it. Enter "%*" [Split points, options] as parameter of the program. You will be asked for the split points and additional options every time you drop a file on this program object.
If you prefer command windows, place the executable somewhere in your PATH.

Usage

Simply drop an MPEG file on the program object or enter splitmp3 filename [options] split points ...
Filename may be the name of an ordinary file, an existing named pipe, a character device or "-" meaning standard input.

Split points

The split points must be at least 2 expressions of the following below. The first is the starting point. The second is the end point. If more than 2 split points are given then more then one output file will be created. It is not possible to create non-adjacent output files. The split points are always rounded to the closest frame location.
[[hh:]mm:]ss[.ff]
Absolute time index from the beginning of the file in hours, minutes, seconds and fractions of seconds. All parts except for the seconds are optional. See examples for further details.
+[[hh:]mm:]ss[.ff]
Relative time index from the last split point in hours, minutes, seconds and fractions of seconds. All parts except for the seconds are optional. See examples for further details.
++[[hh:]mm:]ss[.ff]
Iterative time index starting at the last split point in hours, minutes, seconds and fractions of seconds. All parts except for the seconds are optional. See examples for further details.
*
Till the last valid frame. This must be the last split point.

Options

/n[num]
Set the starting track number of the first output file. The track number is appended to the filename before the file extension (if any). If num is 0 the first output file will not get a track extension. (Be careful not run into a name collision with the input file!) If num is omitted splitmp3 tries to find a track number in the input file name. Without the /n option the first output file gets the track extension 01.
This option is ignored if the alternate naming scheme is used (/t option).
/t
Switch naming scheme to date/time. (Otherwise track numbering is used)
This will search the input filename for a signature like yyyymmdd and hhmmss or something similar. It is an error if this matching fails. Currently the following formats are supported: yyyymmdd...hhmmss, yyyymmdd...hhmm, yymmdd...hhmmss, yymmdd...hhmm, yyyymmddhhmmss and yyyymmddhhmm. The delimiter between date and time (...) is arbitrary. The filename should not contain more than 3 digits in sequence other than the digits from the date and time parts.
The output filenames are generated by adding the absolute offset of the current output from the starting of the input stream to these parts of the filename. Daylight saving is ignored.
Attention: this is likely to fail if you use 0 as first starting point since the output will have the same name than the input. This may destroy the input file if the /o option is used. Use the /b option in this case.
/bname
Set the base file name of the destination file(s).
If name ends with a path separator (\) the filename of the input file without any path components is appended. Otherwise name is taken as it is.
Without the /b option the output files are always created in the current directory. All path components are stripped from the input filename before the output filenames are generated.
/o
Overwrite existing files. Splitmp3 will never overwrite an existing file unless this option is specified.
/v
Verbose mode. Print a short summary for every output stream.
/q
Quiet mode. Suppress progress information. This does not affect warnings and errors written to stderr.

Additional notes

Examples

splitmp3 file.mp3 1:7:18.50 1:12:13.30
splitmp3 file.mp3 1:7:18.50 +4:54.8
splitmp3 file.mp3 67:18.5 72:13.3
splitmp3 file.mp3 4038.5 +294.80
splitmp3 file.mp3 1:0:438.5 4333.3
splitmp3 file.mp3 01:07:18.5 1.2:0:13.3
All of the above expressions are exactly equivalent and create a single output file named file01.mp3 with 4 minutes and 54.8 seconds length.
splitmp3 ..\ripped\wholecd.mp3 0 +2:51 +3:27 +4:50 *
Split a CD into separate tracks. The output files are named wholecd01.mp3, wholecd02.mp3 ff. and written to the current directory.
splitmp3 raw-20051226-102100.mp2 0 39:0 ++1:0:0 /t /b..\split\
Split a large recording into pieces of one hour in length. The timestamps in the filename are updated. The split points are aligned to whole hours. The split point 39:0 completes the first hour. The following parts are always one hour in length except for the last one, which may be shorter depending on the length of the input stream.
Tho output files are written to the folder ..\split\ and named raw-20051226-102100.mp2, raw-20051226-110000.mp2, raw-20051226-120000.mp2 and so on.
some streaming application | splitmp3 - 0 ++12:0:0 /blongstream.mp3
Write the MPEG input stream from stdin into pieces named longstream01.mp3, longstream02.mp3 and so on. Switch every 12 hours to the next file. (This will ensure that the resulting files are not larger than 2GB for bit rates up to nearly 400kbps.)


Download

This program is distributed under the terms of the GNU GENERAL PUBLIC LICENSE.

ZIP file with source, OS/2 binary and this guide: Version 0.1

The OS/2 binary requires the Gcc runtime libc06b5.dll to execute (LGPL) which may be found e.g. at Netlabs.


History

Version 0.1

ToDo, known issues

Handle Xing headers of VBR files
Currently VBR files are splitted correctly from the MPEG streams point of view. But many players rely on the Xing headers to play VBR files correctly. These headers are lost or invalid after the copy process.
Fix the MP3 bit reservoir after cutting
Layer III files spreads the main data over frames in the past. This causes dead references when a file is cut at a frame boundary. This should be fixed when splitting.
ID3 V1.x and V2.x headers are lost
This is by design and will never be fixed. When a file is split into separate pieces there is no generic way to update the ID3 header information to match the newly created fragments logically. If you want this information to be kept use separate ID3 tag utilities after the splitting process.

Contact

Suggestions, help, complaints (but not too much:-): Mail address: mueller-at-maazl-dot-de

Original homepage: http://www.maazl.de/project/mp3/splitmp3.html