always transcode for the highest/lowest resolutions
All checks were successful
Trigger quay.io Webhook / run (push) Successful in 5s
All checks were successful
Trigger quay.io Webhook / run (push) Successful in 5s
This commit is contained in:
parent
dd5847da48
commit
031b03e7e4
1 changed files with 12 additions and 8 deletions
20
src/main.rs
20
src/main.rs
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue