Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $current_path = Get-Location
- $start = $current_path
- $directories = get-childitem -path $current_path -Recurse -Directory
- Foreach ($dir in $directories) {
- Set-Location -literalpath $dir.fullname
- Get-ChildItem *.mkv | where BaseName -notlike '*`[HEVC]' | foreach {
- # Convert the input file and send ffmpeg's output to the display,
- # by piping to Write-Host, rather than trough the pipeline.
- ffmpeg -i $_ -c:v libx265 -c:a copy -x265-params crf=25 "$($_.BaseName) [HEVC].mkv" -y |
- Write-Host
- # Conversion OK? Output the file-info object, which pipes it to Remove-Item.
- if ($LASTEXITCODE -eq 0) { $_ }
- } | Remove-Item -force
- }
- cd $start
- pause
Add Comment
Please, Sign In to add comment