mpgtx a command line MPEG audio/video/system file toolbox, that slices and joins audio and video files, including MPEG1, MPEG2 and MP3.

mpgtx was designed with the good old Unix philosophy in mind : do few but do it well and provide end user an austary yet powerfull command line interface.
At least this was the goal. Reality is different, and it's available for you to try.
mpgtx is released under the GPL license.

You can find more info on mpgtx project here

Quick Links
open bugs
-> submit new
browse CVS


November 03 2005
There was not much action during this year on mpgtx. Real life takes more time, so there is lesser for funny projects. I try to keep bug tracker up-to-date and hope to have some more time next months. I think over closing bug tracker for logged-in users only although I dislike this, because there are plenty of anonymous bug reports that need some clarification by the submitter. If I couldn't reach them and can't reproduce their bug, the reports are nearly useless. So please leave at least your mail address in the bug tracker.

January 02 2005
End of a two years long sleep. Now there is a "Happy new Year"-Release available with waiting patches and some improvements included. Bug tracker is up-to-date now.

November 24 2004
Exactly Two years later we're back on the track thank to Erik Schanze. This guy tracked me, found me and waked me up. He is willing to help and already applied some long waiting patches to the trunk. A bug correcting release is targeted soon. Thanks Erik.

I began to work on Debian packages in summer, to give something back to the community.
I looked for orphaned ones, that I used and that needed help. I found mpgtx, that I had already used to handle MPEG files and for MP3 tagging.
Because an active upstream developer is very useful for a package maintainer to do work on source code for requested features or found bugs, I asked Laurent, if he still work on it.
I got an very friendly answer. I saw a chance to use my knowledge in C++ and get experiences in working with other developers over Internet.
Let's see, that will happen. ;-)

November 24 2002
End of a four monthes long joke. The download links below still pointed (ahahah) to the old version 1.1. I guess I finally understood why so many people kept bothering with gcc 3.2 version errors. Sorry.
Gift of the day : mpgtx is now available for windows here. This is a first attempt, incomplete version : tagmp3 feature is disabled in windows version. You might want to take a look at the updated link section.

August 30 2002
mpgtx 1.3 released with major improvements and new features. Among these are support for mpeg2 encoded files and better playability of mpeg1 and mpeg2 chunks splitted by mpgtx. Also there is a GUI-wrapper for MacOSX available here.
March 5 2002
Daughter V.2.0 released. I'm proud to announce this major familial change. Her name is Salomé and she's cute. What it does mean for mpgtx is less time to code, less time to sleep. I'm sorry not to have time to answer to your mails, gimme a couple of monthes and I'll be back.
mpgtx is not dead but is being rewriten from scratch. It'll be a (handy) library. The most curious among you may want to take a look at it under libmpgtx on the CVS.
November 8 2001
Philipp Biermann provided me with a source and binary tree for macOS X. It's available Here as a contrib. Thank you Philipp.
I'm sorry to say that I'm currently overbooked writing my PhD thesis, please don't hope some radical changes in a near future. I'm actually thinking hard of mpgtx V.2. and I came to the point to consider mpgtx v1 as a fairly useable draft. But mpgtx currently suffers from a not-so-well-designed architecture. A good support for MPEG 2 and a planned support for MPEG 4 aren't seriously conceivable with this architecture. That's why I plan to rewrite it from scratch but it's a long term job. mpgtx v2 will be a MPEG library (yeah I know, yet another one) that'll make it handy to write a command line interface but also a GUI interface.
I'm currently trying to find the best architecture to handle any MPEG streams and any operations you can think of doing on MPEG streams. I've learned by my mistakes that this is the most important part of the developement. A good architecture makes anything straightforward. That's my goal. Wish me good luck.
October 2 2001
mpgtx 1.1 is out, supporting files larger than 2 GB.
This work on large file support is the courtesy of Mattias Sandgren (applause). (I mean Matt coded it all, my only contribution to his work are the bugs I added to his code, to make things funnier.)
Note that large file support only work for systems that... support large files. This means systems that comply with Single UNIX Specification 2.0. As for Linux, this means that you'll need at least a 2.4 kernel and Glibc 2.2. Support for older system is maintained.
Some bugs were fixed in this release, the most visible one being that nasty debug messages won't show up again.
July 23 2001
First stable release, mpgtx v 1.0 is out!
mpgtx seems to be fairly stable by now so here's the first milestone.
Fixed a bug in demultiplexer thank to Steven M Schultz and a gcc 3.0 compiler error thank to Fred Hernandez.


What's inside

>>   mpgtx can currently split and join MPEG 1 video files and most MPEG audio files.
>>   mpgtx can fetch detailed informations from MPEG 1 and MPEG 2.
>>   mpgtx can demultiplex MPEG 1 and MPEG 2 files (System layer, Program layer and Transport Layer).
>>   mpgtx can add, remove and edit ID3 tags from mp3 files and rename mp3 files according to their ID3 tags.

<<   DivX ;) is not yet supported, neither is MPEG 4
<<   splitting and joining of MPEG 2 video files is experimental. (read "will work only in your wildest dreams")
<<   mpgtx can not multiplex audio and video into a system stream.

Show me


Linux Static Binary


Source Code


Windows Exe


mpgtx [mode] [options] file [file | range] ...


mpgtx has five fundamental modes :


When in split or demux mode, you may want to specify a basename to the output files, this is done with the -b BASENAME option.
When in join mode, you may want to specify the output file name, then use -o FILENAME.
Note that the special filename - can be used to specify standard output.
mpgtx uses ranges to find out which part of the file you want to split or join.
ranges is of the form [a-b] where a and b can be time values or file offset values.
Time Values are of the form HH:MM:SS.SSSS where the HH: part can be omited.
Offset Values are a number of bytes optionaly followed by the letter 'M' in which case offset is in Megabytes or 'k' offset is in kilobytes.
The first range must follow an MPEG file name.
Additionaly, half opened ranges can be specified to ensure that two chunks do not overlap :
[a-b] [b-c] produces two overlapping ranges (the b value is guaranteed to be part of each range) and
[a-b] ]b-c] do not overlap since b is contained in the first range only.
myfile.mpg [35:14-1:22:00] corresponds to the range 35 mins 14 secs to 1 h 22 mins of file myfile.mpg
myfile.mpg [42000-520M] corresponds to the range 42000 bytes to 520 Megabytes of file myfile.mpg
Additionaly an empty value corresponds to the file boundary, thus
myfile.mpg [-520M] corresponds to the first 520 Megabytes of file myfile.mpg
myfile.mpg [3:20-] from 3 mins 20 second to the end of myfile.mpg
Another kind of range [part_number/total_parts] can be used
myfile.mpg [1/4] corresponds to the first quarter of myfile.mpg
You may also want to cut a file at a given boundary, mpgtx provide an additional syntax for it :
myfile.mpg {520M} defines two ranges : one from beginning of file to 520 Megabytes, the other from 520 Megabytes to the end of file.
Several dash separated values in ascending order can be specified, thus :
myfile.mpg {a-b-c} defines the four following ranges : [0-a] ]a-b] ]b-c] ]c-]

ID3 tag mode

An ID3 tag is a chunk of extra informations such as artist name, album and genre. ID3 tags are displayed by most mp3 players.
ID3 tag mode supports this modes to help you sort your audio files :

tagmp3 show file
show file's ID3 tag.
tagmp3 set FORMAT file
sets file's ID3 tag according to FORMAT.
tagmp3 move FORMAT file
move file to a destination based on FORMAT.
tagmp3 del file
remove file's ID3 tag if any.
tagmp3 list
displays numeric music genres along with their meaning.

Format String

The format string is a character string composed of zero or more directives: ordinary characters (not %), which are not interpreted and conversion specifications, each of which results in the corresponding ID3 tag field substitution. Each conversion specification is introduced by the character %. The following lines describes each conversion specification along with its associated ID3 field. Special sequence %% is substituted with a single %.

Artist Name
Album Name
Song Title
Track Number

Format string : set mode

For set mode the format string is a list of ID3 fields followed by a ':' (next chars are the field value) or a '?' (ask user for field value)

example: tagmp3 set "%A:Pink Floyd %a:The Wall %t? %T?" *.mp3
For each mp3 of this directory, sets the artist name to Pink Floyd and the album to The Wall. For each file ask for the title and the track number. Leave the other fields untouched. Be aware that genre field require a numeric value. Known genres can be displayed with the list mode.

Format string : move mode

The format string is the destination path where each field identifier is substituted with the tag value.

example: tagmp3 move "/home/foo/mp3/%A/%a/%T-%t.mp3" *.mp3
with the set example above will move all mp3 to "/home/foo/mp3/Pink Floyd/The Wall/{track}-{title}.mp3"
If you prefer the "flat" naming scheme, you will use something like
tagmp3 move "%A-%t.mp3" *.mp3


Additional names

mpgtx comes with four symbolic links which are mpgsplit, mpgcat, mpginfo and mpgjoin.
When called under these names, mpgtx will change its behaviour according to the following :

is equivalent to mpgtx -s
is equivalent to mpgtx -j
is equivalent to mpgtx -j -o -
is equivalent to mpgtx -i
is equivalent to mpgtx -d
is equivalent to mpgtx -T



Enough with the theory, here comes action.

Suppose you want to split matrix-trailer.mpg into 166 playable chunks with the basename mychunk

mpgtx -166 matrix-trailer.mpg -b mychunk
Now processing Chunk 1/166 ...  100.00%  
Now processing Chunk 2/166 ...  92.79%
You will then have 166 files named mychunk-001.mpg to mychunk-166.mpg

Now suppose you want to join file1 and file2 and to append the first 30 Megs of file3 followed by 30 mins of the same file starting at 1hour 10 mins, you want all these chunks into one file materoffactly called thejoinedfile.mpg (yeah suppose you're crazy enough to want to do so)

mpgtx -j file1 file2 file3 [-30M] [1:10:00-1:40:00] -o thejoinedfile.mpg
Now processing Chunk 1/4 ...  100.00%  
Now processing Chunk 2/4 ...  100.00%  
Now processing Chunk 3/4 ...  100.00%  
Now processing Chunk 4/4 ...  100.00%  
And there it is.

Hey why not deleting this annoying 5 minutes intro from movie.mpg?

mpgtx -s movie.mpg [5:00-] -b without_intro
Now processing Chunk 1/1 ...  100.00%  
And you've got your without_intro.mpg file

I want to split this file at 699 Megs so that it can fit on my Video CD!

mpgtx -s file {699M} 
Now processing Chunk 1/2 ...  100.00%  
Now processing Chunk 2/2 ...  45.31%  
Here are chunk-1.mpg and chunk-2.mpg (default basename is chunk)

I wonder about the display size and the duration of this mpegfile

mpgtx -i mpegfile 
  Mpeg 2 System File [Video/Audio]
  Estimated Duration: 01:38:29.51s
  Aspect ratio 4/3 (TV)
  Not interlaced, chroma format: 4:2:0
  Video Format: PAL
  Size [352 x 288]     25.00 fps    1.15 Mbps

User Data:
encoded by TMPGEnc b12a

  Audio : Mpeg 1 layer 2
  192 kbps  44100 Hz
  Stereo,  No emphasis



What's inside this weird MPEG file?

mpginfo weird.tx
  Mpeg 2 Transport Stream [2 programs]
    Program N° 2 contains 2 Elementary Streams:
      Stream 1: MPEG 2 audio [pid: 59]
        audio version 2
      Stream 2: MPEG 2 video [pid: 58]
        video version 1
    Program N° 1 contains 2 Elementary Streams:
      Stream 1: MPEG 2 audio [pid: 57]
        audio version 2
      Stream 2: MPEG 2 video [pid: 56]
        video version 1


Let's demux this transport file.

mpgdemux ../mmedia/teracom_3/Teracom_3 -b weird
 Demultiplexing : [Programs 02 audio 02  video 02] [100.00%]
and you will find four mpeg files :


what about this wagner.mp3 ?

mpgtx -i wagner.mp3
  Audio : Mpeg 2 layer 3
  Estimated Duration: 03:00.70s
  32 kbps  24000 Hz
  Frame size: 96 bytes
  Mono,  No emphasis,  original
  ID3 v1.1 tag
     title   : Der fliegende Hollander
     genre   : Other
  ID3 v2.3.0 tag (more info on
     TRCK : 01
     COMM : (lang: eng) : (empty)
     PCNT : (skipped)
     TLEN : 180000
     TCON : Richard Wagner
     TIT2 : Richard Wagner - Der fliegende Hollander


TODO list



Known Bugs

gigantea centipede
Gigantea Centipede

house spider
House Spider

scarab beetle
Scarab Beetle

Known mpgtx Bugs and limitations




Laurent Alacoque <laureck @ users . sourceforge . net> © 2001
Public key ID : EAD4A9AC
Public key FPR : 6A32 18F7 E8A4 EC10 5136 9A24 8221 3736 EAD4 A9ACCan't open fileHit count : 1 hits
This page was last modified 4588 days ago

Hosting courtesy of
SourceForge Logo