cmd:mpgtx 

Examples 

http://mpgtx.sourceforge.net/#Examples

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
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
weird.tx:
  Mpeg 2 Transport Stream [2 programs]
    Program  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  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 :

weird-2-1.mp3 (Program 2 stream 1)
weird-2-2.m2v (Program 2 stream 2)
weird-1-1.mp3 (Program 1 stream 1)
weird-1-2.m2v (Program 1 stream 2)

what about this wagner.mp3 ?

mpgtx -i wagner.mp3
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 http://www.id3.org/)
     ----------------
     TRCK : 01
     COMM : (lang: eng) : (empty)
     PCNT : (skipped)
     TLEN : 180000
     TCON : Richard Wagner
     TIT2 : Richard Wagner - Der fliegende Hollander
     ----------------

Basic Info 

Info 

mpgtx — an MPeG ToolboX

Description 

mpgtx a command line MPEG audio/video/system file toolbox.

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.

Features 

  • 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.

Comments 

mpgtx1.3 August 29, 2002

ii mpgtx_1.3-1

Help 

Support 

Quick Help 

Usage    : mpgtx [command] [options] [mpegfile [mpegfile | range]...
Commands :
  -i              print infos about following files.
  -s              split following files according to the specified ranges.
  -j              join  following files (ranges may be specified).
  -d              demultiplex elementary streams from following file
  -T              modify id3 tag.
  -h              print this help screen.
  -v              print version informations.
  -#              where # is a number, split the following file in #.
Options  :
  -N              Do not print out excessive information while processing
                  If you use MacOS Classic, this is RECOMMENDED
                  Otherwise mpgtx will be dead slow!
  -f              force overwriting of files, don't ask for confirmation
  -P              keep headers of mpegs which sometimes is usefull
  -X              Try to search for a valid PACK header in the whole file
                  This may result in an endless loop if not successfull!
  -An             While joining or splitting, aspect ratio will be forced to:
                  n=1 -> 1:1, n=2 -> 4:3, n=3 -> 16:9, n=4 -> 2.21:1
  -b NAME         set the basename for the output files
  -o FILE         set the output file name (join implied)
                  if FILE is - , standard output will be used
  --force         force joining of incompatible files
  --no-parachute  don't try to catch SIGSEGV (usefull for debugging)
Ranges   :
  Ranges must follow an mpeg file
  [a-b]           from 'a' inclusive to 'b' inclusive. If you want half opened
                  ranges, you may want to use ]a-b], [a-b[ or ]a-b[ instead
  [num/total]     the 'num' part if the mpeg file was split in 'total'.
                  [1/4] would result in the first quarter of the mpeg file.
  {a-b-...}       where 'a', 'b', ... are in ascending order. Split the file
                  at given values. {700M} is therefore equivalent to ranges
                  [-700M] ]700M-]
Values   :
  Values can be time or offsets in the mpeg file
  Time Format     HH:MM:SS where the HH: part can be omited
  Offset Format   a number optionally followed by:
                    M : offset is in Megabytes
                    k : offset is in Kilobytes
  An empty value means the corresponding file boundary:
                  [-10M]  the first 10 Megabytes of file
                  [500M-] from 500 Megabytes to the end of file

Quick Help 

$ mpgtx movie1.mpg [-0:32] -o joined.mpg
You must choose one options between -i -s -j
Type mpgtx -h for help
$ mpgtx -j movie1.mpg [-0:32] -o joined.mpg
Now processing movie1.mpg 1/1 ...  100.00%
$ rm joined.mpg; mpgtx -j movie1.mpg [8k-10k] -o joined.mpg
Now processing movie1.mpg 1/1 ...  100.00%
$ rm joined.mpg; mpgtx -j movie1.mpg [-0:32] [8k-10k] -o joined.mpg
[8k-10k] is not a valid mpeg file
$ mpgjoin movie1.mpg [-0:32] [15M-25M] -o joined.mpg
[15M-25M] is not a valid mpeg file
$ mpgjoin movie1.mpg [-0:32] [15M-25M] movie2.mpg -o joined.mpg
[15M-25M] is not a valid mpeg file

documented on: 2004.09.22