feat: Implement live video per-segment manifest chain validation (spec 19.3)#3
Open
N1Knight wants to merge 10 commits into
Open
feat: Implement live video per-segment manifest chain validation (spec 19.3)#3N1Knight wants to merge 10 commits into
N1Knight wants to merge 10 commits into
Conversation
…labs/c2pa-rs into feat/live-video-section-19-3
…labs/c2pa-rs into feat/live-video-section-19-3
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.
Summary
Implements C2PA Technical Specification sections 18.25 and 19.3 — the per-segment C2PA Manifest Box method for live video signing and validation.
Each CMAF/DASH media segment carries its own C2PA Manifest containing a
c2pa.livevideo.segmentassertion. The implementation covers both ends: aLiveVideoSignerthat produces signed segments with a cryptographic continuity chain, and aLiveVideoValidatorthat verifies it.Section 18.25 (
c2pa.livevideo.segmentassertion) is also included here as required groundwork.Changes
c2pa.livevideo.segmentassertion —LiveVideoSegmentCBOR assertion withsequenceNumber,streamId,continuityMethod,previousManifestId, and open-ended extension fields. IncludesContinuityMethodenum with lossless round-trip for unknown future methods.LiveVideoSigner(SDK) — signs init and media segments one at a time, managing sequence numbers andpreviousManifestIdautomatically. Supports resuming the continuity chain across separate process invocations viaresume_from_segment. Stream identity (streamId) is read from the manifest JSON; state fields (previousManifestId,nextSequenceNumber) can be persisted there too viaupdated_manifest_json.LiveVideoValidator(SDK) — stateful validator for §19.3 streams. Validates init segments (§19.7.1) and media segments (§19.7.2): ordering, stream identity, manifest continuity, andpreviousManifestIdlinkage.5 new validation status codes —
livevideo.init.invalid,livevideo.segment.invalid,livevideo.manifest.invalid,livevideo.assertion.invalid,livevideo.continuityMethod.invalid.live-video-signCLI subcommand — signs a stream from the command line. ReadsstreamIdfrom the manifest JSON;--previous-segmentresumes the chain across invocations;--initoptionally signs the init segment.live-videoCLI subcommand — validates a signed stream from the command line.BMFF
stypsupport — extended the BMFF IO handler to acceptstyp(Segment Type Box) in addition toftyp, enabling signing and reading of real DASH.m4smedia segments.Validation rules implemented
mdatboxlivevideo.init.invalidlivevideo.segment.invalidsequenceNumbernot strictly increasinglivevideo.assertion.invalidstreamIdchanged between segmentslivevideo.assertion.invalidcontinuityMethodmissinglivevideo.continuityMethod.invalidcontinuityMethod == c2pa.manifestIdwithoutpreviousManifestIdlivevideo.continuityMethod.invalidpreviousManifestIddoesn't match preceding segment's manifest IDlivevideo.segment.invalidcontinuityMethodlivevideo.continuityMethod.invalidTest plan
Unit/integration tests:
Manual end-to-end (sign + verify):
Requires live_video_demo/ with input/init.mp4 + input/seg_*.m4s and a manifest.json with a c2pa.livevideo.segment assertion containing streamId.