[BUGFIX] Embedded null byte ffmpeg fix (#1363)
Closes https://github.com/jmbannon/ytdl-sub/issues/710 Fixes the notorious embedded null byte error seen during FFMPEG metadata writes when handling special characters.
This commit is contained in:
parent
1b2e34bad4
commit
7364aac00c
1 changed files with 5 additions and 1 deletions
|
|
@ -201,7 +201,11 @@ def add_ffmpeg_metadata_key_values(file_path: str, key_values: Dict[str, str]) -
|
|||
"-dn", # ignore data streams
|
||||
]
|
||||
for key, value in key_values.items():
|
||||
ffmpeg_args.extend(["-metadata", f"{key}={value}"])
|
||||
# Some special characters (utf-16 maybe?) have null-byte
|
||||
# which results in ffmpeg error, remove them outright
|
||||
value_null_byte_removed = value.replace("\0", "")
|
||||
ffmpeg_args.extend(["-metadata", f"{key}={value_null_byte_removed}"])
|
||||
|
||||
ffmpeg_args.extend(["-codec", "copy", "-bitexact", tmp_file_path])
|
||||
|
||||
FFMPEG.run(ffmpeg_args)
|
||||
|
|
|
|||
Loading…
Reference in a new issue