Advertisement
Plaidstallion

batch-handbrake

Jan 7th, 2021
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. $filelist = Get-ChildItem -path "Z:\<location>\" -filter *.mkv -recurse | Where-Object {$_.DirectoryName -match '<your-regex>'}
  2. Write-Host $filelist.DirectoryName
  3. $num = $filelist | measure
  4. $filecount = $num.count
  5.  
  6. $i = 0;
  7. ForEach ($file in $filelist)
  8. {
  9. $i++;
  10. $oldfile = $file.DirectoryName + "\" + $file.BaseName + $file.Extension;
  11. $newfile = "Z:\<outlocation>" + $file.BaseName + ".mp4";
  12.  
  13. $progress = ($i / $filecount) * 100
  14. $progress = [Math]::Round($progress,2)
  15.  
  16. Clear-Host
  17. Write-Host -------------------------------------------------------------------------------
  18. Write-Host Handbrake Batch Encoding
  19. Write-Host "Processing - $oldfile"
  20. Write-Host "File $i of $filecount - $progress%"
  21. Write-Host -------------------------------------------------------------------------------
  22. Start-Process "C:\Users\<user>\Desktop\HandBrake\HandBrakeCLI.exe" -ArgumentList "-i `"$oldfile`" -o `"$newfile`" -v -O --align-av -e x264 --two-pass -q 20 --vfr --all-audio --subtitle-burned none --all-subtitles -E av_mp4 -B 128 -6 stereo --non-anamorphic --keep-display-aspect -w 720 --subtitle-burned=none --subtitle-default none --no-markers --verbose=0" -Wait -NoNewWindow
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement