Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Bad BMFF" when signing mp4 file via builder.sign_file #462

Open
schnerd opened this issue May 1, 2024 · 0 comments
Open

"Bad BMFF" when signing mp4 file via builder.sign_file #462

schnerd opened this issue May 1, 2024 · 0 comments

Comments

@schnerd
Copy link

schnerd commented May 1, 2024

Context

I have an MP4 file that I'd like to attach C2PA metadata to. I'm trying to use Builder.sign_file to sign the video file (and importantly calculate the hash so I don't end up with a claim.hardBindings.missing error).

When I run Builder.sign_file on the mp4, I get the following error:

Error: asset could not be parsed: Bad BMFF

After some debugging, I see that this specific line is triggering the error:

let header = BoxHeaderLite::read(reader)
.map_err(|_err| Error::InvalidAsset("Bad BMFF".to_string()))?;

If I log the unmapped error it is a Error: Bad file descriptor (os error 9). I've tried this on mp4s from many different sources and it's the same error.

Reproduction

I created a minimal test case that replicates the issue: schnerd@ebb0698

Note that the mp4 I added there is a test mp4 with no c2pa metadata (the existing mp4s in the fixtures directory already contain c2pa metadata, so didn't want to test with those)

Other notes

I initially tried Manifest.embed_from_memory, but that doesn't seem to generate hashes for mp4s, I think because get_object_locations_from_stream is not implemented for BmffIO. I'm now using Manifest.embed instead, which seems to work in the meantime. But it looks like Builder.sign_file is the direction that things are headed in the future so figured it's still worth opening an issue (but feel free to close if it's expected because it's an unstable api as of 0.32.0)

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

No branches or pull requests

1 participant