Use file: URI to not let ffmpeg fall over with colons in names

This commit is contained in:
Olivier 'reivilibre' 2022-11-21 15:56:18 +00:00
parent 3415f9acf2
commit 0457582ed5
2 changed files with 5 additions and 5 deletions

View File

@ -34,8 +34,8 @@ def has_audio_not_in_lang(meta: Dict[str, Any], lang: str) -> bool:
def make_dubstrip_command( def make_dubstrip_command(
file: Path, outfile: Path, meta: Dict[str, Any], keep_lang: str file: Path, outfile: Path, meta: Dict[str, Any], keep_lang: str
) -> List[Union[str, Path]]: ) -> List[str]:
cmd = ["ffmpeg", "-nostdin", "-i", file, "-map", "0"] cmd = ["ffmpeg", "-nostdin", "-i", f"file:{file}", "-map", "0"]
for stream in meta["streams"]: for stream in meta["streams"]:
if stream["codec_type"] == "audio": if stream["codec_type"] == "audio":
@ -44,7 +44,7 @@ def make_dubstrip_command(
cmd += ["-map", f"-0:{idx}"] cmd += ["-map", f"-0:{idx}"]
# Only remux; don't recode. # Only remux; don't recode.
cmd += ["-c", "copy", outfile] cmd += ["-c", "copy", f"file:{outfile}"]
return cmd return cmd

View File

@ -28,13 +28,13 @@ class DubstripTestCase(unittest.TestCase):
"ffmpeg", "ffmpeg",
"-nostdin", "-nostdin",
"-i", "-i",
fin, "file:a.mkv",
"-map", "-map",
"0", "0",
"-map", "-map",
"-0:1", "-0:1",
"-c", "-c",
"copy", "copy",
fout, "file:b.mkv",
], ],
) )