Bash script to convert a YouTube video to a high-quality GIF file with a specified resolution, frame rate, start time, duration, aspect ratio, and quality. It utilizes yt-dlp
, ffmpeg
, and optionally gifski
.
- Download YouTube videos and convert to high-quality GIFs
- Customizable resolution, frame rate, and aspect ratio (16:9, 4:3, 1:1, or 9:16)
- Adjustable quality settings
- Automatic installation of missing dependencies
- Saves user preferences for conversion method
- Easy uninstall of dependencies
yt-dlp
(for downloading YouTube videos)ffmpeg
(for video processing)
gifski
(for higher quality GIF generation)
The script automatically checks for missing dependencies and offers to install them on supported systems:
- Ubuntu/Debian: Uses apt-get for ffmpeg and installs yt-dlp binary directly
- Fedora/Red Hat: Uses dnf for ffmpeg and installs yt-dlp binary directly
- Arch Linux: Uses pacman
- macOS: Uses Homebrew
- Make the script executable:
chmod +x make_gif.sh
- Run:
./make_gif.sh
(orsudo ./make_gif.sh
on Linux for first-time installation) - Follow the prompts to specify:
- YouTube URL
- Start time and duration
- Resolution and aspect ratio
- FPS (frames per second)
- Quality setting (High: 100, Medium: 80, Low: 60, or Custom: 1-100)
- Output filename
./make_gif.sh --uninstall
- Removes all dependencies and configuration files
-
FFmpeg (Default)
- Faster conversion
- Smaller file sizes
- Uses palette generation
-
Gifski (Optional)
- Higher quality output
- Better color preservation
- Slower conversion
Your preference for gifski is saved and can be changed by:
- Running the uninstall command and reinstalling
- Removing the
.giftube_config
file