Skip to content

Instantly share code, notes, and snippets.

@itorr
Created June 29, 2023 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itorr/fc4872604c84e0765c9329c2a218a93e to your computer and use it in GitHub Desktop.
Save itorr/fc4872604c84e0765c9329c2a218a93e to your computer and use it in GitHub Desktop.
批量加速视频.ps1
$outputDir = "./output_fast2"
if (!(Test-Path -Path $outputDir)) {
New-Item -ItemType Directory -Path $outputDir
}
Get-ChildItem -Path $sourceDir -Filter *.mp4 | ForEach-Object {
$outputFilename = Join-Path $outputDir ("$($_.BaseName)_fasted.mp4")
ffmpeg -i $_.FullName -vf "select='not(mod(n,300))',setpts=N/(FRAME_RATE*TB)" -r 60 -an -c:v libx264 -preset ultrafast -crf 20 -pix_fmt yuv420p $outputFilename
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment