dubbyOW

av1 frameblender script [nvidia only]

Dec 11th, 2025
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.33 KB | Source Code | 0 0
  1. <# : batch portion
  2. ::mode con: lines=5
  3. @echo off & (for %%I in (%*) do @echo(%%~I) | ^
  4. PowerShell.exe -noexit -noprofile -command "$argv = $input | ?{$_}; iex (${%~f0} | out-string)"
  5. exit /b
  6. : end batch / begin powershell #>
  7.  
  8. $OUTPUT_FPS = 60
  9.  
  10. # Force AV1 NVENC with audio copy
  11. $enc_args = "-c:v av1_nvenc -preset p5 -cq 20 -c:a copy"
  12.  
  13. if ($isLinux -or $PSScriptRoot) {
  14.     $argv = $args
  15. }
  16.  
  17. $argv | ForEach-Object {
  18.    
  19.     # Probe input video metadata
  20.     $Metadata = ((ffprobe.exe -v quiet -print_format json -show_format -show_streams -i $($_.trim())) | ConvertFrom-Json).Streams
  21.     $VideoFPS = Invoke-Expression $($Metadata.avg_frame_rate | Select-Object -First 1)
  22.  
  23.     $item = Get-Item $_
  24.     $basename = $item.BaseName -replace "\.$"
  25.  
  26.     $Out = Join-Path $item.Directory.FullName ($basename + '-TMIX.MP4')
  27.     $frames = $($VideoFPS / $OUTPUT_FPS)
  28.     Write-Host "tmixing $basename`: $VideoFPS/$frames=$OUTPUT_FPS"
  29.  
  30.    # Build ffmpeg command
  31.    $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"
  32.     Invoke-Expression $arguments
  33.  
  34.     if ($LASTEXITCODE -ne 0) {
  35.         ''
  36.         Write-Host 'Something went wrong, pausing..' -ForegroundColor Red
  37.         ''
  38.         pause
  39.     }
  40. }
  41.  
  42. exit
  43.  
Advertisement
Add Comment
Please, Sign In to add comment