# h264timestamper

`h264timestamper` updates the DTS (Decoding Time Stamp) of each frame based on H.264 SPS codec setup data, specifically the frame reordering information written in the SPS indicating the maximum number of B-frames allowed.

In order to determine the DTS of each frame, this element may need to hold back a few frames in case the codec data indicates that frame reordering is allowed for the given stream. That means this element may introduce additional latency for the DTS decision.

This element can be useful if downstream elements require correct DTS information but upstream elements either do not provide it at all or the upstream DTS information is unreliable.

For example, mp4 muxers typically require both DTS and PTS on the input buffers, but in case where the input H.264 data comes from Matroska files or RTP/RTSP streams DTS timestamps may be absent and this element may need to be used to clean up the DTS timestamps before handing it to the mp4 muxer.

This is particularly the case where the H.264 stream contains B-frames (i.e. frame reordering is required), as streams without correct DTS information will confuse the muxer element and will result in unexpected (or bogus) duration/framerate/timestamp values in the muxed container stream.

## Example launch line

    gst-launch-1.0 filesrc location=video.mkv ! matroskademux ! h264parse ! h264timestamper ! mp4mux ! filesink location=output.mp4

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstCodecTimestamper
                        ╰──h264timestamper

## Factory details

Authors: – Seungha Yang <seungha></seungha>

Classification: – `Codec/Video/Timestamper`

Rank – marginal

Plugin – codectimestamper

Package – GStreamer Bad Plug-ins

## Pad Templates

### `sink`

    video/x-h264:
          alignment: au

Presence – always

Direction – sink

Object type – GstPad

### `src`

    video/x-h264:
          alignment: au

Presence – always

Direction – src

Object type – GstPad

The results of the search are