Created
March 15, 2023 10:31
-
-
Save williammincy/3bd3f8ef9c6b280b440f73ce6362ede0 to your computer and use it in GitHub Desktop.
Creates a video from a folder of images using ffmpeg, with an optional frame rate parameter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function New-VideoFromImages { | |
| param ( | |
| [string]$InputFolder, | |
| [string]$OutputFile, | |
| [int]$FrameRate = 30 | |
| ) | |
| $cmd = "ffmpeg -framerate $FrameRate -pattern_type glob -i '$InputFolder\*.png' -vf `"scale=1280:-1:flags=lanczos`" -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p -vf `"pad=ceil(iw/2)*2:ceil(ih/2)*2`" `"$OutputFile`"" | |
| Invoke-Expression $cmd | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This would be invoked like:
.\New-VideoFromImages.ps1 -InputFolder "C:\Images" -OutputFile "output.mp4" -FrameRate 24