Quantcast
Viewing latest article 18
Browse Latest Browse All 19

Answer by Connor McCormick for How do I convert a video to GIF using ffmpeg, with reasonable quality?

Simple Bash Function

My most commonly used shell command these days

Usage

makeGif inputVideo.mp4

#DESC make a high-quality gif out of a video (esp. .mp4 or .mov)makeGif () {  if [ -z "$1" ]  then    echo "makeGif inputVideo [outputGif]"    return 244  fi  vid="$1"  if [ -z "$2" ]  then    # remove extension    outputVideo="${vid%.*}.gif"  else    outputVideo="$2"  fi  ffmpeg -i "$vid" -vf "scale=1920:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=256[p];[s1][p]paletteuse=dither=floyd_steinberg" -loop 0 "$outputVideo"  echo "GIF created: $outputVideo"}

Viewing latest article 18
Browse Latest Browse All 19

Trending Articles