Skip to content

Comments

Fix recording of video streams with delayes SPS/PPS#2274

Merged
rafaellehmkuhl merged 1 commit intobluerobotics:masterfrom
rafaellehmkuhl:fix-black-frames-old-mcm-ffmpeg-big-duration-probesize
Dec 5, 2025
Merged

Fix recording of video streams with delayes SPS/PPS#2274
rafaellehmkuhl merged 1 commit intobluerobotics:masterfrom
rafaellehmkuhl:fix-black-frames-old-mcm-ffmpeg-big-duration-probesize

Conversation

@rafaellehmkuhl
Copy link
Member

@rafaellehmkuhl rafaellehmkuhl commented Dec 5, 2025

This PR effectively solves the problem of RadCam recordings made with MCM versions prior to 3.22.1 to generate completely black videos.

The solution was to increase the --probesize of FFMPEG to 100MB and the --analyzeduration to 15 seconds. This increases the initial buffer that FFMPEG uses to find the decoding information (SPS and PPS). Since the old versions of MCM send this code every 10 seconds, and the default values are 5MB and 5s, about half the recordings were failing for missing decoding info (SPS and PPS).

Did 20 records in a row with the same ROV that can rarely do two. The problem is gone.

Was also able to process the failing videos that Wilson recorded on the original issue report, with the chunk ZIPs.

Fix #2275

@rafaellehmkuhl rafaellehmkuhl force-pushed the fix-black-frames-old-mcm-ffmpeg-big-duration-probesize branch 2 times, most recently from b51523b to c9387e0 Compare December 5, 2025 20:04
Increasing the `--probesize` to 100MB and `--analyzeduration` to 15
seconds makes it so FFMPEG will try to find the header/info of the
stream till it reach those values, which are much higher than the
default values (5MB and 5 seconds). This allows us to wait more for the
SPS/PPS to be found on an IDR, preventing cases of undecoded video
frames when those take too much to arrive.

This is essential for the usage with old MCM versions (till 3.22.0),
where the SPS/PPS were not sent on every IDR, but every 10 seconds.
@rafaellehmkuhl rafaellehmkuhl force-pushed the fix-black-frames-old-mcm-ffmpeg-big-duration-probesize branch from c9387e0 to 2e2d8d0 Compare December 5, 2025 20:08
@rafaellehmkuhl rafaellehmkuhl marked this pull request as ready for review December 5, 2025 20:15
Copy link
Contributor

@ES-Alexander ES-Alexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed working great on an example set of chunks that was processing to black previously :-)

Not sure how you decided on those limits, but I suppose they're not too crazy, and it's probably better to be conservative here rather than trimming fat for optimal performance. A bit of extra RAM usage to make sure the video recording works seems like a reasonable tradeoff 👍

@rafaellehmkuhl
Copy link
Member Author

rafaellehmkuhl commented Dec 5, 2025

Confirmed working great on an example set of chunks that was processing to black previously :-)

🚀

Not sure how you decided on those limits but I suppose they're not too crazy

Old MCM versions send SPS and PPS every 10 seconds, so 15 seconds give us some margin. The 100MB is accounting for a very unlikeable scenario of a 4K camera at 60fps (normal) at an insanely high bitrate of 7.5 MBps (only normal for very high-end cameras).

and it's probably better to be conservative here rather than trimming fat for optimal performance. A bit of extra RAM usage to make sure the video recording works seems like a reasonable tradeoff 👍

Exactly my thoughts.

@rafaellehmkuhl rafaellehmkuhl merged commit 5272838 into bluerobotics:master Dec 5, 2025
11 checks passed
@rafaellehmkuhl rafaellehmkuhl deleted the fix-black-frames-old-mcm-ffmpeg-big-duration-probesize branch December 5, 2025 20:47
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.

Sometimes, for some video recordings, all frames are black

2 participants