# rtpst2022-1-fecenc

This element takes as input a media stream and up to two FEC streams as described in SMPTE 2022-1: Forward Error Correction for Real-Time Video/Audio Transport Over IP Networks, and makes use of the FEC packets to recover media packets that may have gotten lost.

## sender / receiver example

    gst-launch-1.0 \
      rtpbin name=rtp fec-encoders='fec,0="rtpst2022-1-fecenc\ rows\=5\ columns\=5";' \
      uridecodebin uri=file:///path/to/video/file ! x264enc key-int-max=60 tune=zerolatency ! \
        queue ! mpegtsmux ! rtpmp2tpay ssrc=0 ! rtp.send_rtp_sink_0 \
      rtp.send_rtp_src_0 ! udpsink host=127.0.0.1 port=5000 \
      rtp.send_fec_src_0_0 ! udpsink host=127.0.0.1 port=5002 async=false \
      rtp.send_fec_src_0_1 ! udpsink host=127.0.0.1 port=5004 async=false

    gst-launch-1.0 \
      rtpbin latency=500 fec-decoders='fec,0="rtpst2022-1-fecdec\ size-time\=1000000000";' name=rtp \
      udpsrc address=127.0.0.1 port=5002 caps="application/x-rtp, payload=96" ! queue ! rtp.recv_fec_sink_0_0 \
      udpsrc address=127.0.0.1 port=5004 caps="application/x-rtp, payload=96" ! queue ! rtp.recv_fec_sink_0_1 \
      udpsrc address=127.0.0.1 port=5000 caps="application/x-rtp, media=video, clock-rate=90000, encoding-name=mp2t, payload=33" ! \
        queue ! netsim drop-probability=0.05 ! rtp.recv_rtp_sink_0 \
      rtp. ! decodebin ! videoconvert ! queue ! autovideosink

With the above command line, as the media packet size is constant, the fec overhead can be approximated to the number of fec packets per 2-d matrix of media packet, here 10 fec packets for each 25 media packets.

Increasing the number of rows and columns will decrease the overhead, but obviously increase the likelihood of recovery failure for lost packets on the receiver side.

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──rtpst2022-1-fecenc

## Factory details

Authors: – Mathieu Duponchelle

Classification: – `SMPTE 2022-1 FEC encoding`

Rank – none

Plugin – rtpmanager

Package – GStreamer Good Plug-ins

## Pad Templates

### `fec_%u`

    application/x-rtp:

Presence – sometimes

Direction – src

Object type – GstPad

### `sink`

    application/x-rtp:

Presence – always

Direction – sink

Object type – GstPad

### `src`

    application/x-rtp:

Presence – always

Direction – src

Object type – GstPad

## Properties

### columns

    “columns” guint

Number of columns to apply row FEC on, 0=disabled

Flags : Read / Write / Construct

Default value : 0

### enable-column-fec

    “enable-column-fec” gboolean

Whether the encoder should compute and send column FEC

Flags : Read / Write / Construct

Default value : true

### enable-row-fec

    “enable-row-fec” gboolean

Whether the encoder should compute and send row FEC

Flags : Read / Write / Construct

Default value : true

### pt

    “pt” gint

The payload type of FEC packets

Flags : Read / Write / Construct

Default value : 96

### rows

    “rows” guint

Number of rows to apply column FEC on, 0=disabled

Flags : Read / Write / Construct

Default value : 0

The results of the search are