Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <# : batch portion
- ::mode con: lines=5
- @echo off & (for %%I in (%*) do @echo(%%~I) | ^
- PowerShell.exe -noexit -noprofile -command "$argv = $input | ?{$_}; iex (${%~f0} | out-string)"
- exit /b
- : end batch / begin powershell #>
- $OUTPUT_FPS = 60
- # Force AV1 NVENC with audio copy
- $enc_args = "-c:v av1_nvenc -preset p5 -cq 20 -c:a copy"
- if ($isLinux -or $PSScriptRoot) {
- $argv = $args
- }
- $argv | ForEach-Object {
- # Probe input video metadata
- $Metadata = ((ffprobe.exe -v quiet -print_format json -show_format -show_streams -i $($_.trim())) | ConvertFrom-Json).Streams
- $VideoFPS = Invoke-Expression $($Metadata.avg_frame_rate | Select-Object -First 1)
- $item = Get-Item $_
- $basename = $item.BaseName -replace "\.$"
- $Out = Join-Path $item.Directory.FullName ($basename + '-TMIX.MP4')
- $frames = $($VideoFPS / $OUTPUT_FPS)
- Write-Host "tmixing $basename`: $VideoFPS/$frames=$OUTPUT_FPS"
- # Build ffmpeg command
- $arguments = "ffmpeg -hide_banner -loglevel warning -stats -hwaccel cuda -i `"$($item.FullName)`" -vf tmix=frames=$frames`:weights=1 -r $OUTPUT_FPS $enc_args `"$Out`" -y"
- Invoke-Expression $arguments
- if ($LASTEXITCODE -ne 0) {
- ''
- Write-Host 'Something went wrong, pausing..' -ForegroundColor Red
- ''
- pause
- }
- }
- exit
Advertisement
Add Comment
Please, Sign In to add comment