Editing mpeg files

1.Introduction

    Avidemux can read (indexed) mpeg file, both elementary streams, program streams and transport streams

    Internally, the mpeg are seen as frames with a fake codec (MPEG).

    If you save the file in copy mode, you will end up with mpeg inside avi, but since it is non standard, only avidemux will be able to read it back.

2.Splitting, external muxing

General 

    As usual, define the section you are interested in using and . You should read cutting if you did not already.

Audio 

    No special care to take here. Just save the audio in copy mode using File->Save audio menu entry. You will end-up with either foo.mp2 or foo.ac3.

Video 

    For video, we will use File->Save raw stream. This menu entry will ask the demuxer the raw data, bypassing the mpeg decoding step. It will also reconstruct the PTS/DTS logic to have a compliant mpeg stream.

    Now you have a foo.m1v or foo.m2v mpeg1/2 elementary stream which should be synced with foo.mp2.

System 

    Now it is time to remultiplex both streams to end-up with foo.mpg. The first seq_header has the timestamp of the first frame (uncut). It may confuse mplex and you will end up with tons of error/warning messages.

    The best is to use tcmplex from transcode to mux them back together.

3.Splitting, internal muxing

General 

    As usual, define the section you are interested in using and . You should read cutting if you did not already. In that mode, avidemux will write a mpeg2 PS stream using libmplex. The stream will be suitable for dvd authoring using dvdauthor.

Audio 

    Audio must be 48 kHz and either MP2 or AC3 (as of today it means libavcodec AC3 or libavcodec MP2). It can be either from copy and/or process mode (for example editing a PVR capture file).

Video 

    The video must be mpeg (that seems obvious). As for audio, it can be in copy mode (edited PVR or DVD) or process mode (converted avi or converted nuv).

Saving 

    Now, it is time to use output format Mpeg A+V (PS). If audio and video are not synced you can use the timeshift audio filter, even in copy mode.

Important 

    There is two importants things to consider here :

    • The muxing will introduce by default a 40 ms shift. Can be neglected if the sync was perfect.
    • When saving as mpeg PS, the GOP timestamp will be recomputed to avoid jump in case of edited PVR streams.