Search

MPGTX: Lossless editing of MPEG video

May 13th, 2007 edited by Tincho

Entry submitted by William Tracy. We are running out of articles ! Please help DPOTD and submit good articles about software you like !

MPEG is the JPEG of the video world. It is a format that plays everywhere, and has built-in lossy compression. Unfortunately, that means that, also like a JPEG, if you open and edit an MPEG you will lose more and more quality with each save. Worse, since video files tend to be large, many people will take MPEG compression as far as it will go, creating files that look yucky to start with.

Mpgtx is a partial solution to the problem. It allows you to slice and splice videos without re-compressing them. The video quality and bit-rate (ratio of file size to the length of the movie) stay the same while you chop off the last thirty seconds of your home video or you stick two videos back to back.

This is a command-line utility. For example, mpgtx -j movie1.mpg movie2.mpg -o movie3.mpg creates a file movie3.mpg that consists of movie1.mpg and movie2.mpg back-to-back. mpgtx -s movie1.mpg [30-1:00] -o movie2.mpg creates a file movie2.mpg that includes everything in movie1.mpg from the thirty-second mark to the one-minute mark.

Support

Mpgtx is a shining example of what is so wonderful about Debian. The last update on the upstream website is over a year old —but new patches continue to go into the Debian package.

Several months ago, I ran into a bug in Mpgtx. My digital camera created MPEG files that caused Mpgtx to segfault. At first, I thought I was out of luck when I saw that the application’s maintainer had disappeared. Then I tried filing a bug report via Debian’s reportbug. Lo and behold, I got a response from the package’s maintainer, Erik Schanze. Within a few weeks, I had a working patch piping hot from the oven that fixed my problem. Mpgtx 1.3.1-3, which fixes my bug, is now available in Testing and Unstable.

Conclusion

Mpgtx is a handy little program. It isn’t useful for serious video editing, but it very nice for quickly hacking some already-compressed video that was supposed to be already "finished". It deserves a place in the tool-belt of any command-line-savvy multimedia artist.

Packages and Links

Mpgtx has been available as a Debian package since May 2001; it is present in Sarge, Etch and Lenny (I can’t find info about older releases). It is also present in every version of Ubuntu. For some reason, the package is under the "Sound" category, so look for it there with Aptitude or Synaptic.

Website: http://mpgtx.sourceforge.net/

Posted in Debian, Ubuntu |

3 Responses

  1. Joost Says:

    The reason it is in audio is probably that it also works fine to split mp3 files.

  2. Nick Craig-Wood Says:

    In my experience mpgtx works well for well formed MPEG files.

    However if you are working with MPEG files which may have errors in (like those captured from digital TV) then you’ll want to take a look at :-

    http://project-x.sourceforge.net/

    It requires Java to run, but that isn’t a barrier to Debian users now-a-days. It is very good at correcting MPEG files with errors in and retaining audio-video sync. It also has a GUI for selecting the cut points.

    If you have well formed MPEG then another choice is avidemux which has a very fast GUI, available from

    http://www.debian-multimedia.org/

  3. tianlou Says:

    I edited many mpegs with this software.
    Now, since last year, new versions of video softwares (vlc, totem, mplayer, xmms…….) don’t read these edited files. At the first jointed point, picture stops (sound continues).
    Many files became a lot of scraps. This is for me a big damege.