Fix ass filter path escape on windows (#262)

This commit is contained in:
bytedream 2023-11-06 21:10:15 +01:00
parent 7594412f58
commit e5d9c27af7

View file

@ -378,8 +378,27 @@ impl Downloader {
output_presets.extend([ output_presets.extend([
"-vf".to_string(), "-vf".to_string(),
format!( format!(
"ass={}", "ass='{}'",
subtitles.get(position).unwrap().path.to_str().unwrap() // ffmpeg doesn't removes all ':' and '\' from the filename when using
// the ass filter. well, on windows these characters are used in
// absolute paths, so they have to be correctly escaped here
if cfg!(windows) {
subtitles
.get(position)
.unwrap()
.path
.to_str()
.unwrap()
.replace('\\', "\\\\")
.replace(':', "\\:")
} else {
subtitles
.get(position)
.unwrap()
.path
.to_string_lossy()
.to_string()
}
), ),
]) ])
} }