Media/embedded timecode sync#13432
Closed
sm9cc wants to merge 3 commits into
Closed
Conversation
Use FFmpeg S12M frame side data to align network media sources by embedded timecode instead of packet arrival time. Expose the setting for FFmpeg network sources and keep it disabled for local files and full decode paths.
S12M non-drop timecode at fractional rates used wall-clock seconds plus a frame offset. That made adjacent labels at a second boundary shorter than one frame, causing timecode sync to jitter. Use frame counts for fractional non-drop timecode so 30000/1001 and 60000/1001 sources keep a steady frame cadence. Keep exact integer-rate and drop-frame paths unchanged.
This comment was marked as abuse.
This comment was marked as abuse.
Author
AI code is not allowed, sadly. |
This comment was marked as abuse.
This comment was marked as abuse.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds embedded timecode synchronization support to FFmpeg-backed media playback sources.
The change parses embedded S12M timecode metadata from decoded video frames and adds a media source option to align playback timestamps to those timecodes. This is intended for MPEG-TS media streams where embedded timecodes can be used to synchronize playback.
The PR also adds focused media playback tests for S12M parsing, including fractional frame-rate cadence handling.
Live stream:
https://www.twitch.tv/mrpol
Screenshot:
Demo video:
https://www.youtube.com/watch?v=QYW37yn7ZQQ
Motivation and Context
This allows OBS media sources to synchronize playback using embedded timecodes instead of relying only on local receive/decode timing.
The motivation for this change is a delivery driving stream with two live camera perspectives: one phone inside the car and one phone mounted outside the car. Both feeds need to remain synchronized in OBS even though each phone may be using a different mobile network with different delay, jitter, and temporary signal degradation.
This is useful for FFmpeg-backed media workflows where senders embed timecode metadata and the receiver needs stable timestamp alignment inside OBS.
How Has This Been Tested?
Tested on Linux with a local OBS Debug build.
Real-world test:
Two phones were used while driving through areas with varying mobile signal. Each phone streamed simultaneously to a separate ingest endpoint, and the streams were added to OBS as separate FFmpeg-backed media sources with the new timecode sync option enabled. The phones were on different mobile networks, and both were running Moblin with its timecodes feature enabled.
During the drive, each phone had connection degradation at different times. In each case, the affected source recovered and returned to sync with the other source without visible drift.
The linked demo video shows the synchronization result.
Commands run:
Types of changes
Checklist: