Created
August 22, 2025 13:21
-
-
Save VicoErv/29bfa31d52beb903494b5bc9b609db3f to your computer and use it in GitHub Desktop.
simplified gif creation for discord or tenor
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 mkgif { | |
| param( | |
| [Parameter(Mandatory=$true, Position=0)] | |
| [string]$InputFile, | |
| [Parameter(Mandatory=$true, Position=1)] | |
| [string]$OutputFile, | |
| [Parameter(Mandatory=$false)] | |
| [int]$StartTime = 0, | |
| [Parameter(Mandatory=$false)] | |
| [int]$Duration = 3, | |
| [Parameter(Mandatory=$false)] | |
| [int]$FPS = 10, | |
| [Parameter(Mandatory=$false)] | |
| [int]$Width = 320 | |
| ) | |
| $ffmpegCmd = "ffmpeg -ss $StartTime -t $Duration -i `"$InputFile`" -vf `"fps=$FPS,scale=${Width}:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse`" -loop 0 `"$OutputFile`"" | |
| Write-Host "Converting $InputFile to $OutputFile..." -ForegroundColor Green | |
| Write-Host "Command: $ffmpegCmd" -ForegroundColor Yellow | |
| Invoke-Expression $ffmpegCmd | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment