Skip to main content

What are PTS and DTS?

Note: When streaming with low latency, if you turn off B-frames (as we recommend in RTMP and SRT), then PTS and DTS will match.

Why correct timestamps matter

Live streaming pipelines depend on a continuous, monotonic timestamp timeline. When timestamps are correct:
  • Frames decode without interruption
  • Segments are aligned for HLS/DASH
  • Players maintain real-time playback
  • Audio and video stay synchronized
  • CDN caching and delivery remain stable
Incorrect timestamps quickly break these assumptions. If timestamps are incorrect at the master-encoder, every downstream component in Cloud like cloud-transcoder, CDN, and even end-player, may experience failures ranging from minor buffering to complete playback interruption.

Problems caused by incorrect or broken PTS/DTS

Below are some example scenarios of poor PTS generation by your encoder: Non-monotonic PTS/DTS:
You see that for frame F3 it is impossible to clearly determine whether the frame needs to be dropped or what to do with them. It is also often simply impossible to process such random PTSs when the .ts/.m4v chunk has already been prepared, saved, and sent to the CDN. PTS/DTS gaps:
You see that starting from frame F4 it is impossible to clearly determine whether the frame needs to be dropped or what to do with them. Missing, repeated, or negative timestamps:
You see that starting from frame F2 it is impossible to clearly determine whether frames need to be dropped, or what to do with constantly repeating frames.

What happens in Cloud transcoder

When PTS/DTS timestamps arrive damaged or inconsistent, the transcoder attempts several forms of recovery. These actions help keep the stream running but often introduce visible or structural issues in the output. Decoder behavior: The transcoder may drop frames or introduce momentary visual artifacts while trying to reconstruct the correct order. If timestamps jump backward or become impossible to interpret, the decoder can trigger a full reset, causing brief interruptions in the output. Segment alignment issues: Incorrect PTS values lead to segment durations that are too short, too long, or overlapping. This breaks the timing model required for HLS and DASH, and low-latency variants (LL-HLS, LL-DASH) become unsynchronized because their chunk boundaries no longer match real frame timing. Audio/video synchronization drift: As the transcoder attempts to normalize the timeline, A/V alignment may shift across renditions. Players often compensate by dropping or repeating frames, which can result in noticeable sync errors. Increased end-to-end latency: To rebuild a usable timestamp sequence, the transcoder may buffer additional frames internally. This buffering pushes the entire pipeline further from real time, degrading low-latency performance. Stream rejection: If timestamps are severely corrupted and cannot be repaired, the ingest layer or the transcoder may reject the stream altogether to prevent downstream delivery failures.

Impact on end playback

Incorrect PTS/DTS can cause:
  • Bufferings
  • Stalled video
  • Audio ahead/behind video
  • Abrupt quality switches (ABR logic confusion)
  • Complete playback failure on Smart TVs and mobile players
Stable timestamps are one of the most critical factors for reliable live streaming delivery.

Best practices to avoid timestamp issues

Maintain Monotonic Timestamps

  • Ensure PTS and DTS always increase in your master stream
  • Do not reset timestamps mid-stream
  • Avoid switching timebases
This is the expected behavior of the encoder for preparing the master stream:

Validate at Ingest

  • Detect and normalize backwards or missing PTS/DTS
  • Drop corrupted frames rather than passing them downstream
  • Log PTS/DTS anomalies for troubleshooting

Monitor Stream Quality

  • Track PTS gaps, overlaps, and drift
  • Monitor GOP sizes and keyframe intervals
  • Alert on timestamp irregularities that may affect playback

Encoder Configuration

  • Disable B-frames: bframes=0
  • Disable scene cuts: scenecut=0
  • Disable deep lookahead: rc-lookahead=0
  • Use fixed GOP intervals (keyframe every 1-2s)
  • Use low-latency presets:
    -preset veryfast -tune zerolatency
By following recommended encoder settings, maintaining predictable GOP structures, and validating timestamps early in the workflow, you ensure resilient live streaming across all platforms.