# mplex

This element is an audio/video multiplexer for MPEG-1/2 video streams and (un)compressed audio streams such as AC3, MPEG layer I/II/III. It is based on the mjpegtools library. Documentation on creating MPEG videos in general can be found in the MJPEG Howto and the man-page of the mplex tool documents the properties of this element, which are shared with the mplex tool.

## Example pipeline

     gst-launch-1.0 -v videotestsrc num-buffers=1000 ! mpeg2enc ! mplex ! filesink location=videotestsrc.mpg

This example pipeline will encode a test video source to an MPEG1 elementary stream and multiplexes this to an MPEG system stream.

If several streams are being multiplexed, there should (as usual) be a queue in each stream, and due to mplex' buffering the capacities of these may have to be set to a few times the default settings to prevent the pipeline stalling.

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──mplex

## Factory details

Authors: – Andrew Stevens , Ronald Bultje , Mark Nauwelaerts

Classification: – `Codec/Muxer`

Rank – none

Plugin – mplex

Package – GStreamer Bad Plug-ins

## Pad Templates

### `audio_%u`

    audio/mpeg:
        mpegversion: 1
              layer: [ 1, 3 ]
           channels: [ 1, 8 ]
               rate: [ 8000, 96000 ]
    audio/x-ac3:
           channels: [ 1, 8 ]
               rate: [ 8000, 96000 ]
    audio/x-dts:
    audio/x-raw:
             format: { S16BE, S20BE, S24BE }
               rate: { (int)48000, (int)96000 }
           channels: [ 1, 6 ]

Presence – request

Direction – sink

Object type – GstPad

### `src`

    video/mpeg:
       systemstream: true

Presence – always

Direction – src

Object type – GstPad

### `video_%u`

    video/mpeg:
        mpegversion: { (int)1, (int)2 }
       systemstream: false
              width: [ 16, 4096 ]
             height: [ 16, 4096 ]
          framerate: [ 0/1, 2147483647/1 ]

Presence – request

Direction – sink

Object type – GstPad

## Properties

### bufsize

    “bufsize” gint

Target decoders video buffer size (kB) [default determined by format if not explicitly set]

Flags : Read / Write

Default value : 0

### format

    “format” GstMplexFormat *

Encoding profile format

Flags : Read / Write

Default value : mpeg-1 (0)

### mux-bitrate

    “mux-bitrate” gint

Bitrate of output stream in kbps (0 = autodetect)

Flags : Read / Write

Default value : 0

### packets-per-pack

    “packets-per-pack” gint

Number of packets per pack for generic formats

Flags : Read / Write

Default value : 1

### sector-size

    “sector-size” gint

Specify sector size in bytes for generic formats

Flags : Read / Write

Default value : 2048

### system-headers

    “system-headers” gboolean

Create system header in every pack for generic formats

Flags : Read / Write

Default value : false

### vbr

    “vbr” gboolean

Whether the input video stream is variable bitrate

Flags : Read / Write

Default value : false

## Named constants

### GstMplexFormat

#### Members

`mpeg-1` (0) – Generic MPEG-1
`vcd` (1) – Standard VCD
`vcd-nsr` (2) – User VCD
`mpeg-2` (3) – Generic MPEG-2
`svcd` (4) – Standard SVCD
`svcd-nsr` (5) – User SVCD
`vcd-still` (6) – VCD Stills sequences
`svcd-still` (7) – SVCD Stills sequences
`dvd-nav` (8) – DVD MPEG-2 for dvdauthor
`dvd` (9) – DVD MPEG-2
`atsc-480i` (10) – ATSC 480i
`atsc-480p` (11) – ATSC 480p
`atsc-720p` (12) – ATSC 720p
`atsc-1080i` (13) – ATSC 1080i

The results of the search are