always transcode for the highest/lowest resolutions
All checks were successful
Trigger quay.io Webhook / run (push) Successful in 5s

This commit is contained in:
Dominic 2025-05-03 00:52:43 +02:00
parent dd5847da48
commit 031b03e7e4
Signed by: msrd0
GPG key ID: AAF7C8430CA3345D

View file

@ -12,7 +12,7 @@ use render_video::{
render::Renderer,
time::parse_date
};
use std::fs;
use std::{collections::BTreeSet, fs};
#[derive(Debug, Parser)]
struct Args {
@ -215,13 +215,17 @@ fn main() {
// rescale the video
if let Some(lowest_res) = args.transcode.or(preset.transcode) {
for res in Resolution::STANDARD_RESOLUTIONS.into_iter().rev() {
if res > project.source.metadata.as_ref().unwrap().source_res
|| res > args.transcode_start.unwrap_or(preset.transcode_start)
|| res < lowest_res
{
continue;
}
let highest_res = args.transcode_start.unwrap_or(preset.transcode_start);
let source_res = project.source.metadata.as_ref().unwrap().source_res;
let mut resolutions = Resolution::STANDARD_RESOLUTIONS
.into_iter()
.collect::<BTreeSet<_>>();
resolutions.retain(|res| {
*res <= source_res && *res <= highest_res && *res >= lowest_res
});
resolutions.insert(highest_res);
resolutions.insert(lowest_res);
for res in resolutions {
if !project.progress.transcoded.contains(&res) {
videos.push(renderer.rescale(&project.lecture, res).unwrap());
project.progress.transcoded.insert(res);