Skip to content

Conversation

@seydx
Copy link
Contributor

@seydx seydx commented Oct 28, 2025

Dynamically extracts and updates codec parameters (SPS/PPS for H.264, VPS/SPS/PPS for H.265) from the first keyframe when they are missing or incomplete in the initial stream setup.

Problem

Some RTSP cameras don't send parameter sets in the DESCRIBE response, resulting in missing or incorrect codec FmtpLine. This causes issues with MSE playback (incorrect aspect ratios) and other consumers that rely on accurate codec information.

Solution

  • Extract parameter sets from the first keyframe with complete data
  • Update codec.FmtpLine dynamically in format handlers (RepairAVCC, RTPDepay)
  • Apply handlers in probe consumer for universal coverage

Note: The FmtpLine update happens during processing of the first keyframe, so it does not affect the first consumer but benefits all subsequent consumers. This makes it ideal for use with preload - the preloader processes the first keyframe and updates the codec parameters, then all following consumers receive the correct FmtpLine.

Fixes #1634

@AlexxIT AlexxIT self-assigned this Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Known problem: incorrect video aspect ratio in MSE mode

2 participants