User Tools

Site Tools


using:cutting_mpeg_files

Cutting MPEG files

Avidemux can read (indexed) MPEG files, either Elementary Stream, Program Stream or Transport Stream.

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

If you save the file in copy mode, be sure not to let the format be set to AVI, else you will end up with MPEG-in-AVI files which are uncommon and not accepted by many applications.

Usually you will want to use one of the following as a format:

  • MPEG PS A+V: The most common MPEG format, used for VCD,SVCD or DVD.
  • MPEG TS A+V: Used by DVB-S or DVB-T. The file produced is globally OK, but some equipments choke on it.
  • MPEG video: Just save the raw elementary video stream (.m1v/.m2v), useful if you use another muxing application.

Both PS & TS will produce an MPEG file containing audio and video.

Splitting, internal muxing

General

As usual, define the section you are interested in using A and B. You should read cutting if you did not already. If the format is “MPEG PS A+V”, Avidemux will write an MPEG-2 Program Stream (PS) using libmplex. The stream will be suitable for DVD authoring using dvdauthor, or VCD/SVCD authoring using VCDImager depending on the detected format.

Audio

  • For DVD, audio must be 48(nbsp)kHz and either MP2 or AC3 (as of today it means libavcodec AC3, Aften AC3, libavcodec MP2 or TwoLAME).
  • For SVCD, audio must be 44.1(nbsp)Khz stereo MP2 (FFMP2 or TwoLAME).
  • For VCD, audio must be 44.1(nbsp)Khz stereo MP2 and 224(nbsp)kb/s (FFMP2 or TwoLAME).

Audio can be either from copy 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 from AVI or other formats).

Saving

The output format should be set to “MPEG PS A+V”. If audio and video are not synced, you can use A/V shift, even in copy mode.

Notes

There are two importants things to consider here:

  • The muxing will introduce a 40(nbsp)ms shift by default. 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.

Splitting, external muxing

General

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

Audio

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

Video

For video, set the output format to “MPEG video” and save the result. This 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 MPEG-1/MPEG-2 Elementary Stream which should be synced with foo.mp2.

Muxing

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.

If you have problems, use tcmplex from Transcode to mux them back together.

using/cutting_mpeg_files.txt · Last modified: 2012/11/11 08:51 (external edit)