mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
add attribute string length check for ffmpeg conversion
This commit is contained in:
parent
f386045a0d
commit
13238a4eed
1 changed files with 25 additions and 0 deletions
|
|
@ -328,6 +328,12 @@ def should_convert_for_ffmpeg(src_filepath):
|
||||||
if review_channels is None:
|
if review_channels is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
for attr_value in input_info["attribs"].values():
|
||||||
|
if (
|
||||||
|
isinstance(attr_value, str)
|
||||||
|
and len(attr_value) > MAX_FFMPEG_STRING_LEN
|
||||||
|
):
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -404,6 +410,25 @@ def convert_for_ffmpeg(
|
||||||
oiio_cmd.append("--frames")
|
oiio_cmd.append("--frames")
|
||||||
oiio_cmd.append("{}-{}".format(input_frame_start, input_frame_end))
|
oiio_cmd.append("{}-{}".format(input_frame_start, input_frame_end))
|
||||||
|
|
||||||
|
ignore_attr_changes_added = False
|
||||||
|
for attr_name, attr_value in input_info["attribs"].items():
|
||||||
|
if not isinstance(attr_value, str):
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Remove attributes that have string value longer than allowed length
|
||||||
|
# for ffmpeg
|
||||||
|
if len(attr_value) > MAX_FFMPEG_STRING_LEN:
|
||||||
|
if not ignore_attr_changes_added:
|
||||||
|
# Attrite changes won't be added to attributes itself
|
||||||
|
ignore_attr_changes_added = True
|
||||||
|
oiio_cmd.append("--sansattrib")
|
||||||
|
# Set attribute to empty string
|
||||||
|
logger.info((
|
||||||
|
"Removed attribute \"{}\" from metadata"
|
||||||
|
" because has too long value ({} chars)."
|
||||||
|
).format(attr_name, len(attr_value)))
|
||||||
|
oiio_cmd.extend(["--eraseattrib", attr_name])
|
||||||
|
|
||||||
# Add last argument - path to output
|
# Add last argument - path to output
|
||||||
base_file_name = os.path.basename(first_input_path)
|
base_file_name = os.path.basename(first_input_path)
|
||||||
output_path = os.path.join(output_dir, base_file_name)
|
output_path = os.path.join(output_dir, base_file_name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue