Skip to content

Instantly share code, notes, and snippets.

@wngreene
Last active April 2, 2020 22:57
Show Gist options
  • Save wngreene/281e9b968a615bdba34df4ad5220dcaf to your computer and use it in GitHub Desktop.
Save wngreene/281e9b968a615bdba34df4ad5220dcaf to your computer and use it in GitHub Desktop.
Convert folder of images to an h264 video.
#! /usr/bin/env bash
# Create a video from a folder of images.
FOLDER=${1}
OUTPUT_FILE=${2}
FPS=${3-30}
FMT=${4-%010d.png}
CODEC=${5-libx264rgb}
CRF=${6-0} # 0-lossless, 18-"visually" lossless, 23-default, 51-most compression.
pushd .
cd ${FOLDER}
ffmpeg -r ${FPS} -i ${FMT} -c:v ${CODEC} -crf ${CRF} ${OUTPUT_FILE}
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment