Loading...
Loading...
Post-process video files and generate optimized GIFs. Converts webm/mp4 to GIF with configurable quality settings.
npx skill4agent add athola/claude-night-market gif-generation- Validate input video file exists
- Check ffmpeg installation
- Execute GIF conversion
- Verify output and report results--help# Check file exists and get info
if [[ -f "$INPUT_FILE" ]]; then
file "$INPUT_FILE"
ffprobe -v quiet -show_format -show_streams "$INPUT_FILE" 2>/dev/null | head -20
else
echo "Error: Input file not found: $INPUT_FILE"
exit 1
fi--help.webm.mp4.mov.aviif ! command -v ffmpeg &> /dev/null; then
echo "Error: ffmpeg is not installed"
echo "Install with: sudo apt install ffmpeg (Linux) or brew install ffmpeg (macOS)"
exit 1
fi
ffmpeg -version | head -1--helpffmpeg -i input.webm -vf "fps=10,scale=800:-1" output.gif--helpffmpeg -i input.webm -vf "fps=10,scale=800:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" output.gif--helpffmpeg -i input.webm -vf "fps=15,scale=1024:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=256:stats_mode=single[p];[s1][p]paletteuse=dither=bayer:bayer_scale=5" output.gif--help| Option | Description | Recommended Value |
|---|---|---|
| Frames per second | 10-15 for smooth, 5-8 for smaller files |
| Width in pixels (-1 maintains aspect ratio) | 800 for web, 480 for thumbnails |
| High-quality scaling algorithm | Always use for best quality |
| Generate optimized color palette | Use for quality-critical output |
| Dithering algorithm | |
# Thumbnail (small, fast loading)
ffmpeg -i input.webm -vf "fps=8,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" thumbnail.gif
# Documentation (balanced)
ffmpeg -i input.webm -vf "fps=10,scale=800:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" docs.gif
# High-fidelity demo
ffmpeg -i input.webm -vf "fps=15,scale=1024:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=256[p];[s1][p]paletteuse" demo.gif--helpif [[ -f "$OUTPUT_FILE" ]]; then
echo "GIF generated successfully: $OUTPUT_FILE"
# Report file size
SIZE=$(du -h "$OUTPUT_FILE" | cut -f1)
echo "File size: $SIZE"
# Get dimensions and frame count
ffprobe -v quiet -select_streams v:0 -show_entries stream=width,height,nb_frames -of csv=p=0 "$OUTPUT_FILE"
else
echo "Error: GIF generation failed"
exit 1
fi--help# Lower fps and resolution
ffmpeg -i input.webm -vf "fps=8,scale=640:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" smaller.gif--helpffmpeg -i input.webm -vf "fps=10,scale=800:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse=dither=floyd_steinberg" smooth.gif--helpffmpeg -i input.webm -vf "fps=10,scale=800:-1" quick.gif--help