Content-type: text/html

# mpgedit

Section: User Commands (1)
Index Return to Main Contents

## NAME

mpgedit - MPEG 1/2/2.5 audio (mp3) file editor

## SYNOPSIS

mpgedit -h | -H | -V | [ -c [inputfile1 [inputfile2...]]]

mpgedit [-s] [-v[v[v[v[v]]]]] [-p] [-d N] [-e [start[-[end]]]] [-E] [-I] [-X[0|1|2]] [-L] [-l volume] [-f] input_file [-o [+]outfile_name ] mpgedit [-D] [-DbN] [-DcN] [-DmN] [-Ds] [-d N] input_file [input_file2 ...]

## DESCRIPTION

mpgedit is an MPEG 1 layer 1/2/3, MPEG 2, and MPEG 2.5 audio (mp3) file editor that is capable of processing both Constant Bit Rate (CBR) and Variable Bit Rate (VBR) encoded files. mpgedit can cut an input MPEG file into one or more output files, as well as join one or more input MPEG files into a single output file. When editing VBR files that have a XING header, mpgedit updates the output file's XING header information to reflect the new file size and average bit rate.

When editing a file, mpgedit locates the nearest MPEG frame boundary for the desired start and end times, then copies the frames between these times to the output file. Since no file decoding / encoding occurs during editing, there is no audio quality loss when editing with mpgedit. For each file being edited, a time index file is created that stores the file position, in bytes, for every 1 second of play time. Indexing guarantees correct and fast random access to edit time offsets for VBR-encoded files.

mpgedit file playback allows edit-time audio playback auditioning, which insures that desired cut occurs at the correct time offset. This feature is necessary when making edits that demand sub-second accuracy (especially with VBR files). Since most MP3 players display playback run times based on a VBR file's average encoded bit rate, edits based on these players' displayed times can miss the desired start or stop time by many seconds.

It is not necessary to use the playback functionality to make edits when the edit start and stop times are already known. The playback feature is merely an aid for accurately locating the desired edit start and stop times.

mpgedit operates in two modes: a command line and a curses-based, full-screen interactive shell. All editing functionality is available in both modes. The chief advantage of the interactive mode comes when using the playback feature for selection and verification of edit begin and end times, which is more rapidly performed interactively.

## COMMAND LINE OPTIONS

Command line mode has the following options available:

-c [input file] [input file 2] ... [input file N]
  Curses edit mode. Enter a full-screen, interactive editing session to play back input files and set begin and end times for each edit. This mode is the default action when no arguments are supplied.
-d N
  Specifies playback or decoding decimation level. When used with playback, every Nth frame is played. When used with -D, the default decimation level of 9 is replaced with the value specified. There is a serious performance penalty for using a smaller decimation level when decoding (-D option), and rarely is the increased silence detection resolution required.
-D
  Decode input files and computes average volume for every decoded frame. The amplitude values are stored in a file named input.lvl. Once decoded, segment boundaries separated by a minimum amplitude threshold are detected, storing the result of that analysis in the file levels_session. The default decimation level used by this operation is 9, or about 3 frames per second. This default is changed with the -d option.
-DbN
  Same as -D, but override the SILENCE_THRESHOLD parameter. The default value is 30, setting the silence threshold to -30db below the average input file amplitude. Lower values detect segment boundaries containing louder content. Valid values are 6-96.
-DcN
  Same as -D, but override the SILENCE_REPEAT parameter, the number consecutive decoded samples below the silence threshold that must occur before a segment boundary is detected. The default value is 3, or about one second of silence when the default decimation level (-d option) of 9 is used.
-DmN
  Same as -D, but override the MINIMUM_TIME parameter, the number of seconds that must elapse once a segment boundary has been detected before another boundary can be detected. The default value is 90 seconds.
-Ds
  Decode the input file, writing the output to standard output.
-e start[-[end]]
  Perform copy/paste operation on input files. The input MP3 file may be encoded as either CBR or VBR. For quick and accurate random access to VBR-encoded files, an external time index file is created. The index file uses the basename of the input file with the '.idx' extension.
  The output files created by this option are located in the same directory as the input MPEG file. When the input directory is read-only, the output is written to the current working directory. When the -o option is not used, the copy/paste data is written to a file with the same basename as the input file with the '_nn.mp3' extension, where nn is an integer value. When a file named basename_nn.mp3 already exists, the integer nn is incremented until the filename is unique. The input MPEG file is never overwritten by this option.
  When only a start time is specified, the copy/paste operation is performed from that start time through the end of file. When just an end time is specified, the copy/paste operation is performed from the beginning of the file through the specified end time. When both start and end times are specified, the portion of the file bracketed by these times is copy/pasted. Start and end times are specified in seconds, or MM:SS.mmm, where MM is minutes, SS is seconds, and mmm are milliseconds. Although any millisecond value may be specified, it will always be rounded off to the next frame boundary, approximately 26ms.
  Multiple -e options are allowed. Each -e represents a separate edit that will be performed on the named input file. When multiple -f options are present, the -e options immediately preceding each -f option apply to that input file.

-E
  Suppress performing edit when -e option is used. Useful when both -e and -v options are used to generate verbose output for a portion of an input file, while performing the edit is not desired.

-I
  Suppress indexing operation prior to performing specified edit. Depending on the situation, this feature may perform the desired edit in less time in conjunction with indexing. One example is cutting a portion of a file being captured in real time while it is being encoded. In this situation, the growing size of the input MP3 file will confuse the index generator. Warning: Seek performance of the -I option is much slower than using an index file, as all frames between the start of the file to the seek time are read.

-f input file name
  Use the named input file. Multiple -f options are allowed. At least one -e option must be precede each -f option.

  If multiple input files are specified, all -e options in a group apply to the -f immediately following a group of -e options. For example:

  mpgedit -e 2-12 -f foo1 -e 20-30 -f foo2

  -e 2-12 applies to foo1, -e 20-30 applies to foo2.

-o output file
  Use the named output file. Prefixing a + to filename causes output from an edit to be appended to the output file. XING headers are automatically updated when using this option.
-h
  Display command line usage summary.
-H
  Display long help information. Detailed usage descriptions for each command line option are displayed.
-l left[:right]
  Set the current playback device volume level to a value between 0 and 100. Specifying only a left value sets both left and right channels to that value.
-L
  Display the current playback device volume level.
-p
  Play MPEG file using external player.
-s
  Silent operation. All of the normal informational messages are suppressed during indexing and editing.
-v
  Verbose output. Adding another v increases verbosity. Up to -vvvvv are allowed. -v displays the frame count and file offset at one second increments. -vv adds the following information for each frame: time offset, bitrate, frame size, frame count, frame position. -vvv adds to -vv and displays a detailed breakdown of each MPEG frame header. -vvvv adds an MD5 checksum to the -vv output. -vvvvv adds an MD5 checksum to the -vvv output.
-V
  Display mpgedit version.
-X[0|1|2]
  Manipulate XING header. -X0 omits the XING header prefix, allowing output to be appended to the end of a previous edit. -X1 fixes the XING header after catenating edits. These two options are largely obsolete because mpgedit now properly updates the XING header when editing and concatenating VBR files. -X2 adds a XING header to a file missing this header, then updates the XING statistics.

  The -X1 modifies the input file's XING header in place. This is the one exceptional case when mpgedit modifies the input file.

  The -X2 option generates a new file, containing the XING header prefix, followed by the contents of the input file. The output file is defaulted when the -o outfile option is not used. The default output file name is the same basename as the input file name, with the '_newxing_nn.mp3' extension, where nn is a unique integer extension.

  This example illustrates the addition of a XING header to a file without this header:

    mpgedit -X2 myfile.mp3

  This command generates the new file myfile_newxing_1.mp3, containing a XING header prefix, followed by the contents of the input file myfile.mp3

  Note: Releases of mpgedit prior to 0.6p1 did not always properly update the Xing header after performing an edit. Using mpgedit 0.6p1, or later, these incorrect headers can be fixed with the following command:

    mpgedit -X1 file_to_fix.mp3

  Note: The addition of a XING header to a CBR file is possible with the -X2 option. Although harmless, the addition of a XING header to such a file is unnecessary, and redundant. However, when joining a CBR file followed a VBR file, the addition of a XING header becomes necessary in order for some MP3 players to properly display the elapsed run time.

## INTERACTIVE MODE COMMANDS

Interactive mode uses single key commands to control editing functionality. Command key binding are similar to vi edit commands. Interactive mode has the following edit commands available:

### CURSOR MOVEMENT

Arrow_Down
  Same as j.
Arrow_Left
  Same as h.
Arrow_Right
  Same as l.
Arrow_Up
  Same as k.
k, Arrow_Up
  Move the cursor up one line.
j, Arrow_Down
  Move the cursor down one line.
l, space, Arrow_Right
  Move the cursor right one field on the current line.
h, Arrow_Left
  Move the cursor left one field on the current line.
TAB
  Toggle between start and end time fields.
H
  Move the cursor home to the first line in the editor.
G
  Move the cursor to the last line in the editor.

### EDITING COMMANDS

ESC
  Undo any changes to the current line. All changes can be undone until the cursor is moved to another line.
,
  Decrease selected time field by one count.
.
  Increase selected time field by one count.

    For each of the start and end time input fields, the minute, second, and millisecond values can be modified. The desired numeric value can be directly input from the keyboard, or the current value can be modified by incrementing or decrementing the current value up with the . command and down with the , command.

A
  Enter autoedit mode. A configuration menu is first presented, which allows setting the input file name, and silence detection parameters, After making any modifications to the configuration menu, the input file is analyzed and silent periods are automatically detected. The main edit window is populated with the start/stop times for each segment separated by a silent period. See the AUTOMATIC EDITING section for additional details about this feature.

  Multiple input file names may be entered, separated by spaces or commas. When a comma separator is used, spaces loose their separator meaning. Use a comma separator makes entering multiple file names where spaces are part of the file name more convenient. Preceding a space character or a comma with a backslash (\) quotes that character, and it is no longer interpreted as a separator. The file named music,1.mp3 must be entered as music\,1.mp3, for example. The file Styx - Mr. Roboto.mp3 must be entered as Styx\ -\ Mr.\ Roboto.mp3 when the comma separator is not used, as each space would be interpreted as a separator.

C
  Clear editor. All currently specified edits are cleared. The user is warned that unsaved changes will be lost before clearing the editor.
c
  Clear currently selected start or end time. All three time components (minutes, seconds and milliseconds) are reset to zero when the c command is entered. Only the currently selected start or end field is cleared with the c command.
P
  Paste the previously deleted line above the cursor position.
p
  Paste the previously deleted line below the cursor position.
O
  Insert a new line above the cursor position.
o
  Insert a new line below the cursor position.
D
  Delete the line at the cursor position.
J
  Join the edit time of the line below the cursor with the current line. The end time of the current line is changed to be the end time of the following line, then the following line is deleted. Before this change is made, the current line and the following line are yanked into the undo buffer.
n
  Specify the output file to save all specified edits to. This name must be specified before the e (perform edit) command will function.
f
  Edit the input filename field. Entering a ^U (ctrl-U) key deletes all characters in the field. Entering a Backspace key deletes only the previous character. Arrow_Left and Arrow_Right positions the cursor within the name field. Characters are added in insert mode, and will not over write following characters. ESC will undo changes and exit the field. Enter will accept the current value as the input filename. The named input file will be indexed when the Enter key is pressed, if the index file does not already exist.
s
  Play the input file at the time specified in the currently selected start or end time field. Playback will continue until any key is pressed. Playback will pause when the Enter key is pressed, and will resume with another Enter key press. During playback, the current time offset is displayed at the bottom of the screen.

  The chief advantage of the s command is the ability to rapidly select a start or end time, begin and end playback, modify the time, and play back again. By repeating these steps, the precise time can be located.

S
  Play the input file up to the time specified in the currently selected start or end time field. Playback will begin at 5 seconds before the selected time, and will stop at the selected time.

  This feature is useful when searching for a break between two music selections, where the previous piece ends loudly and the next piece begins softly. Playing back a few seconds before the edit end time enables precisely locating breaks between pieces of music.

L
  Load edit files and times from a previous mpgedit session. All edit file names and times are saved when exiting an interactive session with the e, E and q commands. The L command loads these saved edit specifications for subsequent modification.
Q
  Quit all edits and discard changes. All work performed during the current interactive session is discarded with this command, so use it with caution.
q
  Quit an interactive edit session and save the current edit files and times. This saved information can be loaded with the L command to resume the edit session at a later time. None of the MPEG file edits occur when using this command. mpgedit prompts for the name of the file to save the edit specifications to. When this file already exists, mpgedit prompts for whether to over write the file. To save to a different file answer no, then q again and modify the save filename.
e
  Perform MPEG file edits using current input file and time specifications. The edits are saved to the output filename specified by the last n command. An output name must be specified with n before e will perform any edits. All input file names and edit times are saved, as with the q command, before the MPEG file edits are performed.
E
  Perform MPEG file edits using current input file and time specifications. The edits are saved to default output filenames. The default output filenames are the same basename as the input file, with the '_nn.mp3' extension appended, where nn is a unique integer value. All input file names and edit times are saved, as with the q command, before the MPEG file edits are performed.
v, V
  Adjust the current playback device volume level. v reduces the volume level by two settings; V increases the volume level by two settings. The allowed volume range is between 0 and 100.

## AUTOMATIC EDITING

mpgedit can edit a file automatically by searching for periods of silence in an input file. Each silent period found represents an edit that will be performed on the input file. The results of this editing analysis are stored in a saved session file named levels_session. This session file can be loaded for review in an mpgedit interactive curses session (see the L interactive mode command) or by xmpgedit (see the Load Session... section described in xmpgedit(1)). Specifying both the -D and -c command line options will load the automatic edits into an mpgedit interactive curses session. Automatic edit mode can be entered in an interactive curses session with the A command.

mpgedit automatic editing requires each input file be decoded into its PCM or .wav representation. This decoding is done only for the purposes of silence detection. Once the edit times for each silence boundary have been detected, all edits are performed on the original input files without decoding or re-encoding. The results of the input file decoding are stored in a corresponding input.lvl file. The .lvl file stores the average volume level for representative frames from the input file. By default, every 9th frame from the input file is decoded, corresponding to approximately 3 volume samples per second. This default may be changed by the -d N option. This skipping of frames is done for performance reasons, since decoding MP3 data to its PCM representation is a computationally expensive operation. For most applications, 3 audio samples per second is sufficient to accurately detect silence boundaries.

This is simplest automatic editing example:

  mpgedit -D input.mp3

These operations are performed by this command:

1.
  Create the index file input.idx when it does not already exist.

2.
  Create the decoded audio levels file input.lvl.

3.
  Search for periods of silent present in input.lvl, then store corresponding edits in the levels_session file.

After this analysis is complete, load the levels_session file into mpgedit for review and further refinement of the edit start and stop times.

Sometimes it is necessary to override one or more of the parameters controlling silence detection. The mpgedit default values generally work for all content, but sometimes it is necessary to tweak these parameters to obtain the desired results.

  mpgedit -Dm30 -Db20 input.mp3

This example reduces to 30 seconds the amount of time that must pass before a subsequent segment boundary can be detected. The silence threshold has also been reduced to -20db, allowing louder sections to be detected as a segment boundary.

Note:
  A space character must not appear between any character in the -DbN, -DcN, or -DmN, options.

Note:
  Creation of the input.lvl file may take a very long time, possibly several minutes depending on the length of the input file and the CPU speed of the computer running mpgedit. Once the input.lvl file has been created, subsequent silence detection passes will run much faster, usually less than a second, depending on the length of the input file.

These parameters control the silence detection analysis, modifying the sensitivity of the detection.

  SILENCE_THRESHOLD (-DbN) Default value: 30
    This parameter specifies how many decibels below the average audio level of entire input file an audio sample must fall before it is considered "silent". The larger the value of this parameter, the quieter an audio sample must be to qualify as an edit boundary. The valid range of this parameter is between 6 and 96.
  SILENCE_REPEAT (-DcN) Default value: 3
    Controls the number of consecutive audio samples quieter than the SILENCE_THRESHOLD that must occur before an edit boundary is detected. The default value is 3, which corresponds to about 1 second of silence when the default decoding decimation (see the -d N option) of 9 is used. Larger SILENCE_REPEAT values reduce the risk of false positive segment boundary detection. However, too large a value for SILENCE_REPEAT also increases the risk a segment boundary will not be properly detected.
  MINIMUM_TIME (-DmN) Default value: 90
    This parameter specifies how many seconds must elapse since the last segment boundary has been detected before another segment boundary can be detected. This parameter is useful for reducing the occurrence of segment boundary false positive detection. Choosing the proper value for this parameter is content dependent. For example, some music contains frequent periods of silence. Sections of silence that occur before the MINIMUM_TIME has expired will be contained within an edit segment, instead of defining a new edit boundary. However, there will always be cases where it is impossible to determine if a period of silence should divide two segments, or should be contained within a segment.

## EXAMPLES

mpgedit -Dm30 -Db36 -c radiomusic.mp3
  Automatically edit the input file radiomusic.mp3. Using -c loads the results of the silence detection analysis into an mpgedit interactive curses session, where the segment start/stop times may be reviewed for correctness in the interactive session before performing the edits on the input file. The MINIMUM_TIME (-Dm30) parameter is set to 30 seconds, and the SILENCE_THRESHOLD (-Db36) parameter is lowered to 36 decibels in this example.

mpgedit -e-6.500 -e6.500-12.500 -e12.500-19 -e19- test1.mp3

  Cut the file test1.mp3 into 4 pieces. The first cut starts at the beginning of test1.mp3, and ends at 6 1/2 seconds; cut 2 begins at 6 1/2 seconds, and ends at 12 1/2 seconds; cut 3 begins at 12 1/2 seconds and ends at 19 seconds; cut 4 begins at 19 seconds and includes the remainder of test1.mp3.

mpgedit -o output.mp3 -e- test1_1.mp3 test1_2.mp3 test1_3.mp3 test1_4.mp3

  Join four MP3 files together into a single output file. The edit time specification -e- means start from the beginning of the file and run through to the end of the file. In this example, only one edit time specification is needed, and is applied to all input file names that follow. Note the -f option can be omitted when the remainder of the command line is input file names.

mpgedit -e19- -f output.mp3 -e-6.500 -f test1.mp3

  This example joins cuts from two different files. The first cut is from output.mp3, start at 19 seconds and ending at the end of file. The second is from from test1.mp3, starting at the beginning of the file and ending at 6 1/2 seconds. The default output filename is used (output_1.mp3). The cuts from both input files are stored in output_1.mp3 because the first cut ends at the end of file and the second cut starts at the beginning of file.

mpgedit -e-6.500 -e12.500-19 -f test1.mp3 -e2.500-6 -f test2.mp3

  Create 3 cuts, two from test1.mp3, one from test2.mp3. In this case, the default output file names are created, resulting in the three cuts stored in test1_1.mp3, test1_2.mp3, and test2_1.mp3, respectively.

mpgedit -o edits.mp3 -e-6.500 -e12.500-19 -f test1.mp3 -e2.500-6 -f test2.mp3

  Performs the same edits as the previous example, but saves the edit results in one output file, named edits.mp3.

mpgedit -e19- -p test1.mp3

  Begin sound playback from the file song1.mp3 beginning 19 seconds into the file.

mpgedit -vvv elgar.mp3

  Parse MPEG audio file frames, and display frame information. This example demonstrates the output displayed when -vvv is used. For the purposes of this discussion, lines tagged with (1), (2) and (3) correspond to -v, -vv and -vvv respectively; the (1), (2) and (3) do not appear in the actual output.

      Found xing header
      h_id      = 1
      h_layer   = 3
      h_protect = 0
      samprate  = 44100
      flags     = 15
      frames    = 18146
      bytes     = 9238103
      vbr_scale = 44

                   ...

      (1)   *** t=1s fr=39 pos=22232 (0x56d8)
      (2) MPEG header t=1.044s  br=192  sz=626  fr=40     pos=22232      pos=0x56d8
      (3) File position:  0      (0x0)
      (3) Frame size:     626    (0x272)
      (3) MPEG version:   3      (MPEG Version 1)
      (3) MPEG layer:     1      (Layer III)
      (3) Protection:     0      (no)
      (3) bitrate:        11     (192)
      (3) sample_rate:    0      (44100)
      (3) Pad:            0      (no)
      (3) Private:        0      (no)
      (3) channel_mode:   1      (Joint stereo)
      (3) joint_ext_mode: 0      (Intensity stereo off; Mid-side stereo off)
      (3) Copyright:      0      (no)
      (3) Original:       1      (yes)
      (3) Emphasis:       0      (None)

                   ...

      File name:    elgar.mp3
      VBR Min:      80
      VBR Max:      192
      VBR Average:  150
      Total frames: 15584
      File size:    7623958
      Track length: 6:47.85 (407s)

      Variable Bit Rate frame statistics
      Bit Rate      Frame Count
      -------------------------
       80 kbps:          1 (<1%)
       96 kbps:         27 (<1%)
      112 kbps:        733 (4%)
      128 kbps:       4169 (26%)
      160 kbps:      10196 (65%)
      192 kbps:        458 (2%)

The message Found xing header indicates the input file is a VBR encoded files with a XING ancillary data header. The only two fields updated by mpgedit are the frames (number of frames in encoding) and bytes (total encoding size in bytes) fields. h_id indicates the MPEG version; only 1=MPEG-1 is recognized. h_layer indicates the MPEG layer; valid values are 1, 2 and 3. h_protect is 1 when the copyright protection is enabled, and 0 when not enabled. samprate is the audio sample rate for the encoding, in hertz (Hz). Both flags and vbr_scale are values internal to the header.

When the -v option is used, only lines with the (1) tag in the example above are displayed. These lines are displayed for each one second of input file play time. t= is the time offset into the input file. fr= is the frame number for this time offset. The file position in bytes (in both decimal and hexadecimal formats) follows pos=.

When the -vv option is used, lines with the (2) tag are displayed in addition to the (1) tag. One (2) line is displayed for each frame present in the MPEG input file. t= is the time offset into the input file, and is displayed with 1 millisecond resolution. br= is the frame encoding bitrate, in kb/s. sz= is the frame size, in bytes. fr= is the frame number for this time offset. pos= is the file position in bytes,displayed in both decimal and hexadecimal formats.

When the -vvv option is used, lines with the (3) tag are displayed in addition to the (1) and (2) tags. These additional lines display all information contained within an MPEG frame, and are displayed for each frame present in the file. Each value is identified by name, followed by the un-interpreted value, followed by the interpreted value, appearing within parentheses.

For all -v options listed above, a summary is printed after the entire file is read. For CBR encoded files, the file name, frame count, file size and play time are displayed. For VBR encoded files, the frame minimum, maximum, and average encoding bitrate is displayed, in addition to the CBR summary. Furthermore, for VBR encoded files, a summary of the total number of frames encoded for each bitrate present in the input file is displayed.

## PLAYBACK CONFIGURATION

mpgedit requires configuration for the sound playback feature to work. As root, run make install. For Linux as part of the installation, the shared library loader is configured to search the directory where mpgedit was installed. These are the actions performed by the install process to configure the shared library loader:

  echo /usr/local/lib >> /etc/ld.so.conf
  /sbin/ldconfig

Sound playback is implemented using two mechanisms: 1) an external command line MP3 player capable of standard input file playback, and 2) the MPGLIB decoder library that ships with the LAME project. The default playback configuration uses the MPGLIB-based decoder plugin libdecoder_mpg123.so.

Two decoder plugin implementations ship with mpgedit: libdecoder_popen.so and libdecoder_mpg123.so. libdecoder_popen.so will execute the mp3decoder.sh script for file playback. libdecoder_mpg123.so is implemented using the MPGLIB decoder library present in LAME. This implementation also serves as a sample implementation of a single process playback plugin that could be ported to the Microsoft Windows(R) operating systems, and other operating systems that do not support the popen() system call.

mpgedit attempts to load the playback plugin libmpgedit_decoder.so when file playback is specified. When the decoder plugin is loaded, it is used for file playback. When the decoder plugin cannot be loaded, the default action is to execute the mp3decoder.sh script.

libmpgedit_decoder.so is installed as a symbolic link pointing to one of the playback plugins, libdecoder_mpg123.so or libdecoder_popen.so. make install installs the libdecoder_mpg123.so playback plugin. libdecoder_popen.so can be installed manually when use of a command line MP3 player is desired.

To use a different command line MP3 player, configure libdecoder_popen.so as the playback plugin, then edit the mp3decoder.sh file to call the desired MP3 player. This shell script is then loaded by mpgedit when performing file playback, and provides the flexibility to specify any MP3 player that can play files from standard input.

## IMPLEMENTATION LIMITATIONS AND ANOMALIES

Since release 0.6p1, mpgedit has been tested with MPEG 1 layer 1/2/3, MPEG 2 layer 1/2/3 and MPEG 2.5 layer 3 files. Since MPEG 2.5 layer 1/2 files have the same frame header structure, it is assumed this program will function properly with such files, although no testing on files encoded with this format has occurred.

While it is possible with mpgedit to join together files that consist of differing encoding versions (MPEG-1 and MPEG-2, for example) and sample rates (44.1KHz and 22.05KHz, for example), caution must be used. Although such a file is technically a legal encoding, it is doubtful that all (or any, for that matter) MP3 players will be able to correctly render such a file.

Any ID3 tags present in input files are not present in the output from an edit. Output files must be tagged to restore ID3 information.

mpgedit implements an MPEG audio frame header parser that is tolerant of many encoder errors, corrupted data, and files with formats that are not strictly MPEG audio files. When such an encoding error is encountered, all data between the last correctly encoded frame and the next recognized frame are silently skipped. Other programs, such as mp3_check, perform a more detailed validity check and report where errors occur, and are likely to be more robust when handling corrupted data files.

Many playback problems present in releases of mpgedit prior to version 0.6p1 have been fixed. Using the libdecoder_mpg123.so plugin, mpgedit properly plays all of the ISO MPEG conformance files, as well as MPEG 2/2.5 files encoded using lame. Two exceptions to the above can be noted. Win32 does not properly handle MPEG 2/2.5 files encoded at with a sample rate of 11025Hz/mono. A work around in the libdecoder_mpg123.so decoder plugin is implemented, but the sound quality suffers. The MPEG 1 layer 1 mono test file http://mpgedit.org/mpgedit/testdata/mpeg1/layer1/fl4.mp1 does not render properly. All the data used to exercise mpgedit is located at http://mpgedit.org/mpgedit/testdata/mpegdata.html.

During development, the previous name of the program was mp3edit. The final name mpgedit was settled on after much development occurred. Because of this, many source files and function names are called mp3_. You will also see mpeg_ instead of mpg_ in some cases.

## ACKNOWLEDGEMENTS AND HISTORY

The first prototype implementation of MP3 file editing was based upon the mp3_check program, written by Eric Bullen, http://sourceforge.net/projects/mp3check. Because the project goals of mp3_check are different than mpgedit, the idea of integrating editing functionality into mp3_check was abandoned. Many of the current command line options for mpgedit can be traced to the early prototype work done with mp3_check.

mpgedit is a completely independent implementation from the early mp3_check editing prototype. While some of the early ideas from this prototype still exist in mpgedit, everything has been re-implemented.

Finding reference material sufficiently complete to implement mpgedit was difficult. The O'Reilly & Associates book "MP3: The Definitive Guide" by Scot Hacker http://www.oreilly.com/catalog/mp3/, while accurate in its description of the MPEG audio file frame header structure, did not contain sufficient detail to fully implement the MPEG file parsing functionality. The document that proved invaluable for completing the MPEG audio frame header parsing code was written by Predrag Supurovic, http://www.dv.co.yu/mpgscript/mpeghdr.htm.

The MPGLIB decoding engine comes from the MPG123 package, written by Michael Hipp (www.mpg123.de). MPGLIB is released under the GPL. The version of MPGLIB used for building the libdecoder_mpg123.so decoder plugin comes from the 3.90 alpha 7 version of LAME http://sourceforge.net/projects/lame. Earlier versions of LAME do not include a shared library build of MPGLIB, which is needed when building the decoder plugin. The MPGLIB that comes with mpg123-0.59r can also be used when linking the libdecoder_mpg123.so plugin. However, LAME appears to have fixed some bugs that mpg123 has not.

Special thanks go to Jared Benedict <http://redjar.org/jared/> and Public Radio Exchange <http://www.prx.org/> for the donation of a Macintosh G3 B&W computer. Completion of the port to Mac OSX 10.3 was possible using this system.

The initial port of the command line and curses mpgedit to Mac OSX 10.1 was done with thanks to Tony Andrea <tony.andrea@pobox.com>.

Thanks to Colin Bell <cpb@tklogic.net> for helping with freshing the Mac OSX 10.1 port.

## SEE ALSO

xmpgedit(1), mp3decoder.sh(1), decoder.so(1), decoder_popen.so(1), decoder_mpg123.so(1)

## Index

NAME
SYNOPSIS
DESCRIPTION
COMMAND LINE OPTIONS
INTERACTIVE MODE COMMANDS
  CURSOR MOVEMENT
  EDITING COMMANDS
AUTOMATIC EDITING
EXAMPLES
PLAYBACK CONFIGURATION
IMPLEMENTATION LIMITATIONS AND ANOMALIES
ACKNOWLEDGEMENTS AND HISTORY
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 06:35:58 GMT, April 17, 2006