Remove duplicated subtitles on archive audio merge

This commit is contained in:
ByteDream 2023-03-23 17:17:55 +01:00
parent bd20c5a7b6
commit c97adb3ce7
2 changed files with 25 additions and 3 deletions

View file

@ -446,7 +446,15 @@ impl Filter for ArchiveFilter {
.iter()
.map(|d| (d.audio.clone(), d.format.audio.clone()))
.collect(),
subtitles: data.iter().map(|d| d.subtitles.clone()).flatten().collect(),
// mix all subtitles together and then reduce them via a map so that only one
// subtitle per language exists
subtitles: data
.iter()
.flat_map(|d| d.subtitles.clone())
.map(|s| (s.locale.clone(), s))
.collect::<HashMap<Locale, Subtitle>>()
.into_values()
.collect(),
}),
MergeBehavior::Auto => {
let mut download_formats: HashMap<Duration, DownloadFormat> = HashMap::new();

View file

@ -285,7 +285,14 @@ impl FFmpegPreset {
if let Some(hwaccel) = hwaccel_opt {
match hwaccel {
FFmpegHwAccel::Nvidia => {
input.extend(["-hwaccel", "cuda", "-hwaccel_output_format", "cuda", "-c:v", "h264_cuvid"]);
input.extend([
"-hwaccel",
"cuda",
"-hwaccel_output_format",
"cuda",
"-c:v",
"h264_cuvid",
]);
output.extend(["-c:v", "h264_nvenc", "-c:a", "copy"])
}
}
@ -303,7 +310,14 @@ impl FFmpegPreset {
if let Some(hwaccel) = hwaccel_opt {
match hwaccel {
FFmpegHwAccel::Nvidia => {
input.extend(["-hwaccel", "cuda", "-hwaccel_output_format", "cuda", "-c:v", "h264_cuvid"]);
input.extend([
"-hwaccel",
"cuda",
"-hwaccel_output_format",
"cuda",
"-c:v",
"h264_cuvid",
]);
output.extend(["-c:v", "hevc_nvenc", "-c:a", "copy"])
}
}