Skip to content

Live stream freeze when enabling liveSync with RTSP → MPEG-TS (FFmpeg) #276

@Forlk4

Description

@Forlk4

Hi, thank you for your great work on mpegts.js.

I’m currently integrating RTSP streaming that is converted to MPEG-TS using FFmpeg. The stream works normally when liveSync is disabled, but once I enable liveSync and related latency-control options, the playback becomes stuck/frozen after running for a short period.
Below are the details:

✔️ Working Configuration (no freeze)

{
  "enableWorker": true,
  "enableStashBuffer": true,
  "stashInitialSize": 131072,

  "isLive": true,
  "liveSync": false,
  "liveSyncMaxLatency": 0,
  "liveSyncTargetLatency": 0,
  "liveSyncPlaybackRate": 1,
  "liveBufferLatencyChasing": false,

  "deferLoadAfterSourceOpen": true,
  "lazyLoad": true,

  "autoCleanupSourceBuffer": false,
  "autoCleanupMaxBackwardDuration": 3,
  "autoCleanupMinBackwardDuration": 1,
  "fixAudioTimestampGap": false
}

❌ Problematic Configuration (stream stuck)

{
  "enableWorker": true,
  "enableStashBuffer": false,
  "stashInitialSize": 65536,

  "isLive": true,
  "lazyLoad": false,

  "liveBufferLatencyChasing": true,
  "liveBufferLatencyMaxLatency": 1.4,
  "liveBufferLatencyMinRemain": 0.4,

  "liveSync": true,
  "liveSyncMaxLatency": 1.5,
  "liveSyncTargetLatency": 1.0,
  "liveSyncPlaybackRate": 1.05,

  "deferLoadAfterSourceOpen": false,
  "autoCleanupSourceBuffer": true,
  "autoCleanupMaxBackwardDuration": 3,
  "autoCleanupMinBackwardDuration": 2,
  "fixAudioTimestampGap": true
}

Behavior

  • When liveSync is enabled, the stream freezes or stops updating.
  • The FFmpeg server performs a reinitialization/recognition every ~30 seconds, which may be related.
  • mpegts.js seems unable to recover playback after FFmpeg’s periodic refresh, while the same stream works fine when liveSync is disabled.

Additional Information

  • FFmpeg is outputting MPEG-TS over HTTP.
  • Browser: Chromium
  • OS: Linux
  • mpegts.js version: v1.8.0

Question

Is this expected behavior when combining liveSync with an RTSP→TS transcoded stream, or is there a recommended configuration for handling periodic FFmpeg refresh events? Any guidance would be greatly appreciated.

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions