add check for the format var type in VideoFromComponents.save_to function

This commit is contained in:
bigcat88 2025-12-02 14:59:32 +02:00
parent a17cf1c387
commit 1e4fb4b131
No known key found for this signature in database
GPG Key ID: 1F0BF0EC3CF22721

View File

@ -337,7 +337,7 @@ class VideoFromComponents(VideoInput):
if codec != VideoCodec.AUTO and codec != VideoCodec.H264: if codec != VideoCodec.AUTO and codec != VideoCodec.H264:
raise ValueError("Only H264 codec is supported for now") raise ValueError("Only H264 codec is supported for now")
extra_kwargs = {} extra_kwargs = {}
if format != VideoContainer.AUTO: if isinstance(format, VideoContainer) and format != VideoContainer.AUTO:
extra_kwargs["format"] = format.value extra_kwargs["format"] = format.value
with av.open(path, mode='w', options={'movflags': 'use_metadata_tags'}, **extra_kwargs) as output: with av.open(path, mode='w', options={'movflags': 'use_metadata_tags'}, **extra_kwargs) as output:
# Add metadata before writing any streams # Add metadata before writing any streams