## mpeg2enc mpeg2enc |

## Properties

gboolean | altscan-mpeg2 | Read / Write
GstMpeg2encAspect | aspect | Read / Write
gint | b-per-refframe | Read / Write
gint | bitrate | Read / Write
gint | bufsize | Read / Write
gboolean | closed-gop | Read / Write
gboolean | constraints | Read / Write
gboolean | correct-svcd-hds | Read / Write
gboolean | dualprime | Read / Write
gboolean | dummy-svcd-sof | Read / Write
gboolean | force-b-b-p | Read / Write
GstMpeg2encFormat | format | Read / Write
GstMpeg2encFramerate | framerate | Read / Write
GstMpeg2encInterlaceMode | interlace-mode | Read / Write
gint | intra-dc-prec | Read / Write
gboolean | keep-hf | Read / Write
gint | max-gop-size | Read / Write
gint | min-gop-size | Read / Write
gint | motion-search-radius | Read / Write
gint | non-video-bitrate | Read / Write
GstMpeg2encVideoNorm | norm | Read / Write
GstMpeg2encPlaybackFieldOrders | playback-field-order | Read / Write
gboolean | pulldown-3-2 | Read / Write
GstMpeg2encQuantisationMatrix | quant-matrix | Read / Write
gfloat | quant-reduction-max-var | Read / Write
gint | quantisation | Read / Write
gfloat | quantisation-reduction | Read / Write
gfloat | reduce-hf | Read / Write
gint | reduction-2x2 | Read / Write
gint | reduction-4x4 | Read / Write
gboolean | sequence-header-every-gop | Read / Write
gint | sequence-length | Read / Write
gint | unit-coeff-elim | Read / Write
gint | vcd-still-size | Read / Write

## Types and Values

| GstMpeg2enc

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstMpeg2enc

## Implemented Interfaces

GstMpeg2enc implements GstPreset.

## Description

This element encodes raw video into an MPEG-1/2 elementary stream using the

mjpegtools library.

Documentation on MPEG encoding in general can be found in the

MJPEG Howto

and on the various available parameters in the documentation of the mpeg2enc tool in particular, which shares options with this element.

### Example pipeline

    1
    gst-launch-1.0 videotestsrc num-buffers=1000 ! mpeg2enc ! filesink location=videotestsrc.m1v

This example pipeline will encode a test video source to a an MPEG1 elementary stream (with Generic MPEG1 profile).

Likely, the “format” property is most important, as it selects the type of MPEG stream that is produced. In particular, default property values are dependent on the format, and can even be forcibly restrained to certain pre-sets (and thereby ignored). Note that the (S)VCD profiles also restrict the image size, so some scaling may be needed to accomodate this. The so-called generic profiles (as used in the example above) allow most parameters to be adjusted.

    1
    gst-launch-1.0 videotestsrc num-buffers=1000 ! videoscale ! mpeg2enc format=1 norm=p ! filesink location=videotestsrc.m1v

This will produce an MPEG1 profile stream according to VCD2.0 specifications for PAL “norm” (as the image height is dependent on video norm).

## Synopsis

### Element Information

plugin | mpeg2enc
author | Andrew Stevens <andrew.stevens@nexgo.de> Ronald Bultje <rbultje@ronald.bitfreak.net>
class | Codec/Encoder/Video

### Element Pads

name | sink
direction | sink
presence | always
details | video/x-raw, format=(string)I420, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction){ 24000/1001, 24/1, 25/1, 30000/1001, 30/1, 50/1, 60000/1001 }

name | src
direction | source
presence | always
details | video/mpeg, systemstream=(boolean)false, mpegversion=(int){ 1, 2 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction){ 24000/1001, 24/1, 25/1, 30000/1001, 30/1, 50/1, 60000/1001 }

## Functions

## Types and Values

### GstMpeg2enc

    typedef struct _GstMpeg2enc GstMpeg2enc;

## Property Details

### The `“altscan-mpeg2”` property

      “altscan-mpeg2”            gboolean

Alternate MPEG-2 block scanning. Disabling this might make buggy players play SVCD streams.

Flags: Read / Write

Default value: TRUE

### The `“aspect”` property

      “aspect”                   GstMpeg2encAspect

Display aspect ratio.

Flags: Read / Write

Default value: Deduce from input

### The `“b-per-refframe”` property

      “b-per-refframe”           gint

Number of B frames between each I/P frame.

Flags: Read / Write

Allowed values: [0,2]

Default value: 0

### The `“bitrate”` property

      “bitrate”                  gint

Compressed video bitrate (kbps).

Flags: Read / Write

Allowed values: [0,40000]

Default value: 1125

### The `“bufsize”` property

      “bufsize”                  gint

Target decoders video buffer size (kB) (default depends on format).

Flags: Read / Write

Allowed values: [20,4000]

Default value: 46

### The `“closed-gop”` property

      “closed-gop”               gboolean

All Group-of-Pictures are closed (for multi-angle DVDs).

Flags: Read / Write

Default value: FALSE

### The `“constraints”` property

      “constraints”              gboolean

Use strict video resolution and bitrate checks.

Flags: Read / Write

Default value: TRUE

### The `“correct-svcd-hds”` property

      “correct-svcd-hds”         gboolean

Force SVCD width to 480 instead of 540/720.

Flags: Read / Write

Default value: FALSE

### The `“dualprime”` property

      “dualprime”                gboolean

Dual Prime Motion Estimation Mode for MPEG-2 I/P-frame only streams. Quite some players do not support this.

Flags: Read / Write

Default value: FALSE

### The `“dummy-svcd-sof”` property

      “dummy-svcd-sof”           gboolean

Generate dummy SVCD scan-data (for vcdimager).

Flags: Read / Write

Default value: TRUE

### The `“force-b-b-p”` property

      “force-b-b-p”              gboolean

Force two B frames between I/P frames when closing GOP boundaries.

Flags: Read / Write

Default value: FALSE

### The `“format”` property

      “format”                   GstMpeg2encFormat

Encoding profile format.

Flags: Read / Write

Default value: Generic MPEG-1

### The `“framerate”` property

      “framerate”                GstMpeg2encFramerate

Output framerate.

Flags: Read / Write

Default value: Same as input

### The `“interlace-mode”` property

      “interlace-mode”           GstMpeg2encInterlaceMode

MPEG-2 motion estimation and encoding modes.

Flags: Read / Write

Default value: Progressive

### The `“intra-dc-prec”` property

      “intra-dc-prec”            gint

Number of bits precision for DC (base colour) in MPEG-2 blocks.

Flags: Read / Write

Allowed values: [8,11]

Default value: 9

### The `“keep-hf”` property

      “keep-hf”                  gboolean

Maximize high-frequency resolution (for high-quality sources).

Flags: Read / Write

Default value: FALSE

### The `“max-gop-size”` property

      “max-gop-size”             gint

Maximal size per Group-of-Pictures (-1=default).

Flags: Read / Write

Allowed values: [G_MAXULONG,250]

Default value: -1

### The `“min-gop-size”` property

      “min-gop-size”             gint

Minimal size per Group-of-Pictures (-1=default).

Flags: Read / Write

Allowed values: [G_MAXULONG,250]

Default value: -1

### The `“motion-search-radius”` property

      “motion-search-radius”     gint

Motion compensation search radius.

Flags: Read / Write

Allowed values: [0,32]

Default value: 16

### The `“non-video-bitrate”` property

      “non-video-bitrate”        gint

Assumed bitrate of non-video for sequence splitting (kbps).

Flags: Read / Write

Allowed values: [0,10000]

Default value: 0

### The `“norm”` property

      “norm”                     GstMpeg2encVideoNorm

Tag output for specific video norm.

Flags: Read / Write

Default value: Unspecified

### The `“playback-field-order”` property

      “playback-field-order”     GstMpeg2encPlaybackFieldOrders

Force specific playback field order.

Flags: Read / Write

Default value: Unspecified

### The `“pulldown-3-2”` property

      “pulldown-3-2”             gboolean

Generate header flags for 3-2 pull down 24fps movies.

Flags: Read / Write

Default value: FALSE

### The `“quant-matrix”` property

      “quant-matrix”             GstMpeg2encQuantisationMatrix

Quantisation matrix to use for encoding.

Flags: Read / Write

Default value: Default

### The `“quant-reduction-max-var”` property

      “quant-reduction-max-var”  gfloat

Maximal luma variance below which quantisation boost is used.

Flags: Read / Write

Allowed values: [0,2500]

Default value: 100

### The `“quantisation”` property

      “quantisation”             gint

Quantisation factor (-1=cbr, 0=default, 1=best, 31=worst).

Flags: Read / Write

Allowed values: [G_MAXULONG,31]

Default value: 0

### The `“quantisation-reduction”` property

      “quantisation-reduction”   gfloat

Max. quantisation reduction for highly active blocks.

Flags: Read / Write

Allowed values: [-4,10]

Default value: 0

### The `“reduce-hf”` property

      “reduce-hf”                gfloat

How much to reduce high-frequency resolution (by increasing quantisation).

Flags: Read / Write

Allowed values: [0,2]

Default value: 0

### The `“reduction-2x2”` property

      “reduction-2x2”            gint

Reduction factor for 2x2 subsampled candidate motion estimates (1=max. quality, 4=max. speed).

Flags: Read / Write

Allowed values: [1,4]

Default value: 3

### The `“reduction-4x4”` property

      “reduction-4x4”            gint

Reduction factor for 4x4 subsampled candidate motion estimates (1=max. quality, 4=max. speed).

Flags: Read / Write

Allowed values: [1,4]

Default value: 2

### The `“sequence-header-every-gop”` property

      “sequence-header-every-gop” gboolean

Include a sequence header in every GOP.

Flags: Read / Write

Default value: FALSE

### The `“sequence-length”` property

      “sequence-length”          gint

Place a sequence boundary after each <num> MB (0=disable).

Flags: Read / Write

Allowed values: [0,10240]

Default value: 0

### The `“unit-coeff-elim”` property

      “unit-coeff-elim”          gint

How agressively small-unit picture blocks should be skipped.

Flags: Read / Write

Allowed values: [-40,40]

Default value: 0

### The `“vcd-still-size”` property

      “vcd-still-size”           gint

Size of VCD stills (in KB).

Flags: Read / Write

Allowed values: [0,512]

Default value: 0

## See Also

mpeg2dec