allow specifying the start resolution for transcoding

This commit is contained in:
Dominic 2024-01-16 00:24:12 +01:00
parent fead583ce9
commit 8e2b72c431
Signed by: msrd0
GPG key ID: DCC8C247452E98F9

View file

@ -44,6 +44,10 @@ struct Args {
#[clap(short, long)]
transcode: Option<Resolution>,
/// Transcode starts at this resolution, or the source resolution, whichever is lower.
#[clap(short = 'T', long, default_value = "1440p")]
transcode_start: Resolution,
/// Treat the audio as stereo. By default, only one channel from the input stereo will
/// be used, assuming either the other channel is backup or the same as the used.
#[clap(short, long, default_value = "false")]
@ -333,7 +337,8 @@ fn main() {
// rescale the video
if let Some(lowest_res) = args.transcode {
for res in Resolution::values().into_iter().rev() {
if res >= project.source.metadata.as_ref().unwrap().source_res
if res > project.source.metadata.as_ref().unwrap().source_res
|| res > args.transcode_start
|| res < lowest_res
{
continue;