Last active
November 12, 2023 20:09
-
-
Save josy1024/e7b95548940094f7c87cee47664f7430 to your computer and use it in GitHub Desktop.
webmotion video files to animated gif file
This file contains 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
$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