Skip to content

Instantly share code, notes, and snippets.

@josy1024
Last active November 12, 2023 20:09
Show Gist options
  • Save josy1024/e7b95548940094f7c87cee47664f7430 to your computer and use it in GitHub Desktop.
Save josy1024/e7b95548940094f7c87cee47664f7430 to your computer and use it in GitHub Desktop.
webmotion video files to animated gif file
$webmDirectory = Get-Location
# Get all *.webm files in the current directory
$webmFiles = Get-ChildItem -Path $webmDirectory -Filter *.webm
# Loop through each *.webm file and convert it to *.gif
foreach ($webmFile in $webmFiles) {
# Build the ffmpeg command
$ffmpegCommand = "ffmpeg.exe -i `"$($webmFile.FullName)`" -vf `"fps=15,scale=498:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse`" -loop 1 `"$($webmFile.FullName).gif`""
# Execute the ffmpeg command
Invoke-Expression $ffmpegCommand
}
Write-Host "Conversion complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment