MP3CHOP

Section: User Commands (1)
Updated: 12th January 2013
Index  

NAME

mp3chop - A tool for chopping up ADTS MP3 and AAC files.  

SYNOPSIS

mp3chop [ -b FitimeFp | --begin=FiTIMEFp ] [ -e FiTIMEFp | --end=FitimeFp ]
        [ --strip-id3=1 | -s 1 ] [ --strip-id3=2 | -s 2 ]
        [ --copyright=0|1 | -c 0|1 ] [ --original=0|1 | -o 0|1 ]
        [ --dump-header | -d ] [ INPUT FILE ]

 

DESCRIPTION

mp3chop is a tool for extracting one part of an MP3 (MPEG 1 or 2 audio) file or an ADTS AAC (MPEG 4 audio) file. It does not (yet) support files in an MPEG 4 container.

mp3chop works by walking the frames of the file knowing how much audio each frame generates and enables/disables output as appropriate depending on the timecode associated with the frame. It doesn't actually understand the contents of the frames. MP3 frames can contain references to other frames and often do. This means that mp3chop can generate output that contains references to frames that do not exist in the output. Because the MP3 is a streaming format decoders should deal with this correctly and glean what information they can from the frames before discarding them if they cannot produce audio from them. Some decoders may output a diagnostic such as "frame discarded" when this happens. AAC ADTS frames are always self contained so this problem does not occur.

Whilst processing the file mp3chop also checks for obvious corruption within the frame headers by checking that they occur at the specified offset from the previous frame. Any frames that fail this test are not output until a good header is found.

mp3chop can also be used for dumping the headers of frames, forcing the copyright and original flags and stripping ID3v1 and ID3v2 tags.

mp3chop expects to read the input file either on standard input or from the supplied filename. It always writes to standard output and reports errors on standard error.

 

OPTIONS

-b TIME, --begin=TIME
Do not output any of the frames that are before TIME in the input. TIME must be in the form 'mm:ss.hh' where mm indicates minutes, ss indicates seconds and hh indicates hundredths of a second.
-e TIME, --end=TIME
Do not output any of the frames that are after TIME in the input. TIME must be in the form 'mm:ss.hh' where mm indicates minutes, ss indicates seconds and hh indicates hundredths of a second.
-s VERSION, --strip-id3=VERSION
Do not output ID3 tags of the specified version (either 1 or 2). This option may be specified multiple times for different versions.
-h, --help
Display short usage information and exit.
-d, --dump-header
Output a description of the header of the first valid frame to standard output. Disables the output of any MP3 data to standard output.
-D, --dump-all-headers
Output a description of the header of every frame in the file to standard output. Disables the output of any MP3 data to standard output.
-c 0|1, --copyright=0|1
Ensure that the copyright flag is set to the specified value in any frames that are output.
-o 0|1, --original=0|1
Ensure that the original flag is set to the specified value in any frames that are output.

 

ADTS AAC

AAC-encoded audio can be stored in various container formats. The most common container format is an ISO MPEG4 container which is a derivative of Apple's QuickTime container format. Files in this format often have a ".m4a" extension. mp3chop cannot (currently) handle files in this format.

AAC-encoded audio can also be stored in the ADTS format. This is a raw stream of frames with simple headers that are similar to those found in MP3 files. mp3chop can handle files in this format.

ffmpeg's avconv command line tool (previously known as ffmpeg) can be used to convert from ISO contained AAC to ADTS AAC with a command line similar to:

avconv -i input.m4a -vn -acodec copy output.aac

 

EXAMPLES

Extract ten seconds from the file tune.mp3 starting at thirty seconds in and write to tune_edit.mp3:
mp3chop -b 0:30.00 -e 0:40.00 tune.mp3 > tune_edit.mp3

Validate the frames in the file tune.mp3 and output the clean version to tune_clean.mp3:

mp3chop < tune.mp3 > tune_clean.mp3

 

AUTHOR

Written by Mike Crowe.  

BUGS

Report bugs to <mac@mcrowe.com>  

SEE ALSO

lame(1), mpg123(1), avconf(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
ADTS AAC
EXAMPLES
AUTHOR
BUGS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 21:34:22 GMT, February 24, 2013