-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Labels
Description
I used the version c2pa-python==0.6.1, when I upload a .mov video, it get this error.
Bad BMFF Other UnsupportedOperation('read')
code
def private_sign(data: bytes) -> bytes:
if isinstance(data, str):
data = data.encode('utf-8')
private_key = os.getenv("C2PA_PRIVATE_KEY")
return sign_ps256(data, base64.b64decode(private_key))
cert_chain = os.getenv("C2PA_CERT")
signer = create_signer(private_sign, SigningAlg.PS256, base64.b64decode(cert_chain), "http://timestamp.digicert.com")
print(signer)
# Create a builder add a thumbnail resource and an ingredient file.
builder = Builder(manifest)
# Sign the builder with a stream and output it to a stream
# This returns the binary manifest data that could be uploaded to cloud storage.
input_stream = open(image_path, "rb")
output_path = os.path.join(output_folder, 'embedded_Metadata'+file_extension)
output_stream = open(output_path, "wb")
c2pa_data = builder.sign(signer, mime_type, input_stream, output_stream)
return output_path