Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $location = Get-Location
- $files = Get-ChildItem $location -Filter "*.mp4" | Sort-Object CreationTime
- $bitrate = "12M"
- # Create directory .\transcoded if it doesn't exist
- if (Test-Path ".\transcoded" -PathType Container) {
- Write-Host ".\transcoded already exists!"
- } else {
- Write-Host "Creating .\transcoded"
- New-Item ".\transcoded" -ItemType Directory
- }
- # Create directory .\original if it doesn't exist
- if (Test-Path ".\original" -PathType Container) {
- Write-Host ".\original already exists!"
- } else {
- Write-Host "Creating .\original"
- New-Item ".\original" -ItemType Directory
- }
- foreach ($file in $files) {
- $arguments = "-loglevel error -hwaccel cuvid -c:v h264_cuvid -i ""$file"" -c:v h264_nvenc -c:a copy -b:v $bitrate ""transcoded\$file"""
- Write-Host "Transcoding ""$file"" -> ""transcoded\$file"""
- Start-Process -Wait -NoNewWindow -FilePath "ffmpeg.exe" -WorkingDirectory $location -ArgumentList $arguments
- Write-Host "Moving ""$file"" -> ""original\$file"""
- Move-Item -Path $file -Destination "original\$file"
- }
Add Comment
Please, Sign In to add comment