Guest User

Untitled

a guest
Jan 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. $location = Get-Location
  2. $files = Get-ChildItem $location -Filter "*.mp4" | Sort-Object CreationTime
  3. $bitrate = "12M"
  4.  
  5. # Create directory .\transcoded if it doesn't exist
  6. if (Test-Path ".\transcoded" -PathType Container) {
  7. Write-Host ".\transcoded already exists!"
  8. } else {
  9. Write-Host "Creating .\transcoded"
  10. New-Item ".\transcoded" -ItemType Directory
  11. }
  12. # Create directory .\original if it doesn't exist
  13. if (Test-Path ".\original" -PathType Container) {
  14. Write-Host ".\original already exists!"
  15. } else {
  16. Write-Host "Creating .\original"
  17. New-Item ".\original" -ItemType Directory
  18. }
  19.  
  20. foreach ($file in $files) {
  21. $arguments = "-loglevel error -hwaccel cuvid -c:v h264_cuvid -i ""$file"" -c:v h264_nvenc -c:a copy -b:v $bitrate ""transcoded\$file"""
  22. Write-Host "Transcoding ""$file"" -> ""transcoded\$file"""
  23. Start-Process -Wait -NoNewWindow -FilePath "ffmpeg.exe" -WorkingDirectory $location -ArgumentList $arguments
  24. Write-Host "Moving ""$file"" -> ""original\$file"""
  25. Move-Item -Path $file -Destination "original\$file"
  26. }
Add Comment
Please, Sign In to add comment