Do you, like me, often find yourself in internet arguments for no good reason and want to reply with a dead-perfect response GIF so everyone will clap and love you even more but the response you want is actually stored in your bookmarks in the superior and lower-bandwidth MP4 format? Fear no more! Assuming you’re nerdy enough to have ffmpeg on your machine, here’s a bash command to automate the process. Just pass the path to your MP4 file as the first argument.

#!/bin/bash

# Check if input parameter is provided
if [ $# -eq 0 ]; then
    echo "Usage: $0 <input.mp4>"
    exit 1
fi

INPUT="$1"
OUTPUT="${INPUT%.mp4}.gif"

# Check if input file exists
if [ ! -f "$INPUT" ]; then
    echo "Error: File '$INPUT' not found"
    exit 1
fi

# Generate palette
ffmpeg -i "$INPUT" -vf "palettegen" palette.png

# Create GIF using palette
ffmpeg -i "$INPUT" -i palette.png -filter_complex "paletteuse" "$OUTPUT"

# Clean up
rm -f palette.png "$INPUT"

echo "Conversion complete: $OUTPUT"

Does It Work?

You bet it does, fella! Be forewarned the images will be huge.

nocountry.gif