Skip to content

Instantly share code, notes, and snippets.

@fredmajor
Created May 29, 2019 12:12
Show Gist options
  • Save fredmajor/6c441f136b2dd9c7c64919f312c90cc7 to your computer and use it in GitHub Desktop.
Save fredmajor/6c441f136b2dd9c7c64919f312c90cc7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use File::Basename;
use Cwd 'abs_path';
use 5.014;
use strict;
use warnings;
use utf8;
my $TARGET_WIDTH="1920";
my $TARGET_EXT=".mov";
my $SUFFIX="_PRORES_HQ" . "_W_" . $TARGET_WIDTH.$TARGET_EXT;
my $argcount=@ARGV;
for (my $c=0; $c < $argcount; $c++){
my $currFile = abs_path(shift);
my($filename, $dirs, $suffix) = fileparse($currFile);
(my $without_extension = $filename) =~ s/\.[^.]+$//;
my $fOutBasename = $without_extension . $SUFFIX;
my $fOut = $dirs . $fOutBasename;
say "fOut:" . $fOut;
# 0 - ‘proxy’
# 1 - ‘lt’
# 2 - ‘standard’
# 3 - ‘hq’
# 4 - ‘4444’
my $cmd1 = qq{ffmpeg -y -i "$currFile" -c:v prores -profile:v 3 -vf scale=$TARGET_WIDTH:-1 -c:a pcm_s16le -ar 44100 "$fOut"};
say "Command is: ". $cmd1;
system $cmd1;
if ( $? == 0 ) {
say "convertion successful"
}
else {
say "convertion failed"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment