Repository navigation
Conversation
|
@don4325 is attempting to deploy a commit to the Margelo Team on Vercel. A member of the Team first needs to authorize it. |
`HybridCameraVideoOutput.setBitRate` read the connection's current codec and applied the bit-rate to it. On formats whose default movie codec is ProRes (the 10-bit 4:2:2 formats of Pro iPhones) the connection does not list `AVVideoCompressionPropertiesKey`, so the guard bailed, the bit-rate was dropped silently and the recorder kept writing ProRes. Observed on an iPhone 17 Pro Max (iOS 27.0.1): the rear camera wrote 33.1 MB in 1.03 s (~257 Mbps) until `maxFileSize` stopped the take. Resolve the codec first: keep the current codec when it is already a compressed one the output offers, otherwise move to HEVC, else H.264. Apply that codec on its own before reading `supportedOutputSettingsKeys`, because the supported keys are reported for the connection's current codec. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
don4325
force-pushed
the
fix/ios-compressed-codec-under-target-bitrate
branch
from
October 16, 2026 19:37
a787e1b to
98b510d
Compare
This branch has not been deployed
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.
Problem
HybridCameraVideoOutput.setBitRate(bitRate:for:)reads the connection's current codec fromoutput.outputSettings(for:)and applies the bit-rate to that codec. On a format whose defaultmovie codec is ProRes (the 10-bit 4:2:2 formats of the Pro iPhones) the connection reports
ProRes and
supportedOutputSettingsKeys(for:)does not includeAVVideoCompressionPropertiesKey,so the guard in
setOutputSettings(bitRate:codec:for:)logs an error and returns. ThetargetBitRatethe caller asked for is dropped silently and the recorder keeps writing ProRes.Observed on an iPhone 17 Pro Max (iOS 27.0.1): the rear camera negotiated a 10-bit 4:2:2 format,
and a recording with
targetBitRateset wrote 33.1 MB in 1.03 s (about 257 Mbps) untilmaxFileSizestopped the take. The only log line was the "cannot use custom bit-rate" error.Fix
compressedCodec(preferring:): an HEVC/H.264 allow-list. Keep the current codec when it is oneof those and the output offers it; otherwise pick the first of HEVC, H.264 that
availableVideoCodecTypescontains; returnnilwhen neither is offered, in which casesetBitRatelogs and leaves the connection untouched (setting a codec the output does not offerraises). An allow-list rather than a ProRes deny-list because any other codec (JPEG, or one the
converter does not know) would drop the bit-rate the same way.
setOutputSettings(bitRate:codec:for:)now applies the codec on its own before readingsupportedOutputSettingsKeys(for:), because the supported keys are reported for theconnection's current codec, and a ProRes connection does not list compression properties
until it has been moved to a compressed one.
A
targetBitRateis a request for a compressed codec, so this does not change behaviour forthe common H.264/HEVC formats: there the current codec is already compressed and is kept.
Verification
swift format --configuration config/.swift-formaton the file produces no diff.react-native-vision-camera@5.2.3. That patch is in review and has not yet reached a device;the production evidence above is of the defect, not of the fix.
Limits
setOutputSettings(settings:)path (user-chosen codec) is untouched; if a userexplicitly selects ProRes and also sets
targetBitRate, the bit-rate call will move thecodec to HEVC. Happy to gate on "codec was not explicitly selected" if you prefer.
馃 Generated with Claude Code