Skip to content

Instantly share code, notes, and snippets.

@peterkappus
Created September 10, 2024 14:27
Show Gist options
  • Save peterkappus/096d36c157c9c7cf294ca51aab868f81 to your computer and use it in GitHub Desktop.
Save peterkappus/096d36c157c9c7cf294ca51aab868f81 to your computer and use it in GitHub Desktop.

Revisions

  1. peterkappus created this gist Sep 10, 2024.
    19 changes: 19 additions & 0 deletions mov_to_gif.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #!/bin/bash

    # TIP: use Quicktime Player to capture a short screencast and convert to animated gif.
    # Great for sharing software demos in chat/etc.

    # Check if input and output file parameters are provided
    if [ $# -ne 2 ]; then
    echo "Usage: $0 <input_file> <output_file>"
    exit 1
    fi

    INPUT_FILE=$1
    OUTPUT_FILE=$2

    # Run the docker command with the provided filenames
    docker run -i -v "$(pwd)":/data jrottenberg/ffmpeg \
    -i "/data/$INPUT_FILE" \
    -filter_complex "[0:v] fps=5,scale=480:-1,split [a][b];[a] palettegen=max_colors=16 [p];[b][p] paletteuse" \
    "/data/$OUTPUT_FILE"