Skip to content

Instantly share code, notes, and snippets.

@stuf
Created June 1, 2015 19:03
Show Gist options
  • Save stuf/12e132b3a1c705130337 to your computer and use it in GitHub Desktop.
Save stuf/12e132b3a1c705130337 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ -z $EVENT ]; then echo "Event code (EVENT) required"; exit 1; fi
if [ -z $REEL ]; then echo "Reel identifier (REEL) required"; exit 1; fi
# Defaults for params
if [ -z $TAKE ]; then echo "Take identifier (TAKE) not specified, defaulting to \"A\"."; fi
# Set default resolution if none specified
if [ -z $IW ]; then IW=1920; fi
if [ -z $IH ]; then IH=1080; fi
if [ -z $OUTPATH ]; then OUTPATH="."; fi
FOOTAGE_BASE=$(pwd)/Footage
IN=$(pwd)/Source/$EVENT/$REEL/$INFILE
OUT=$FOOTAGE_BASE/$EVENT/$REEL/$EVENT-$REEL-$TAKE.mov
# Ensure directory structure
if [ ! -d $FOOTAGE_BASE/$EVENT/$REEL ]; then
echo "Creating: $FOOTAGE_BASE/$EVENT/$REEL"
mkdir -vp $FOOTAGE_BASE/$EVENT/$REEL
fi
# ffmpeg-relevant config
FILTER="crop=iw:iw/($IW/$IH):0:(ih/2)-((iw/($IW/$IH))/2),setdar=dar=16/9,setsar=1:1,scale=$IW:-1"
FPS=24
PIXFMT=yuv444p10
echo ""
echo "Event: $EVENT\tReel: $REEL/$TAKE\tResolution: $IW*$IH"
echo "Filter args:\t\t$FILTER"
echo "Infile:\t\t$IN"
echo "Outfile:\t$OUT"
echo ""
# Finally, put things in motion
ffmpeg -f image2 -pattern_type glob -i "$IN" -framerate $FPS \
-vf $FILTER -sws_flags lanczos -an -r $FPS \
-vcodec prores -profile:v 2 -pix_fmt $PIXFMT $OUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment