Skip to content

Instantly share code, notes, and snippets.

@xionluhnis
Created January 11, 2023 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xionluhnis/864cda9c0b0d93797d8c4bead5253f46 to your computer and use it in GitHub Desktop.
Save xionluhnis/864cda9c0b0d93797d8c4bead5253f46 to your computer and use it in GitHub Desktop.
Generate a timelapse from JPG images using FFMPEG
#!/usr/bin/env bash
[[ -z "$FR" ]] && FR=30
[[ -z "$W" ]] && W=-1
[[ -z "$H" ]] && H=1080
[[ -z "$F" ]] && F=0.125
[[ -z "$TR" ]] && TR=2
INPUT="$1"
[[ -n "$2" ]] && OUTPUT="$2" || OUTPUT="${INPUT//\/}.mp4"
# ffmpeg -framerate $FR -pattern_type glob -i "$INPUT/*.JPG" -c:v libx264 -crf 17 -pix_fmt yuv420p -vf "transpose=0" -vf scale=-1:800 "$OUTPUT"
ffmpeg -framerate $FR -pattern_type glob -i "$INPUT/*.JPG" -c:v libx264 -crf 17 -pix_fmt yuv420p -vf "transpose=$TR,scale=$W:$H,setpts=$F*PTS" "$OUTPUT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment