Here's a partial code snip. I'd like to test the duration of the original .avi to the newly created .mp4 and
display a warning if they are not within a second of each other:
The duration shows as "length" in Windows explorer
----------------------------------------------------
$movies = ls -recurse $inputpath\*.avi
$starttime = get-date
foreach($movie in $movies){
$name = $movie.fullname
$basename=$movie.basename
$outname=$name.Replace(".avi",".mp4")
# skip if mp4 already exists (Literalpath needed as square brackets in the filename causes problems
if(!(test-path -literalpath "$outname")){
write-output "$outname Started at $now"
handbrakecli -i "$name" -o "$outname" --preset="Normal" 2>&1>> D:\'$Data'\convmp4.log
$now = get-date
write-output "$outname Done at $now">>d:\'$Data'\convmp4Done.log
$now=get-date
$elapsedrun=$now-$starttime
if ($elapsedrun.Totalminutes -ge $runlimit){
write-host "Time limit reached of $runlimit minutes at $now"
write-output "Time limit reached of $runlimit minutes at $now">>d:\'$Data'\convmp4Done.log
exit
}
}
else{
write-output "Skipping (already exists): $outname $length"
}
}
- Edited by Mar778 19 hours 42 minutes ago