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