Skip to content

Instantly share code, notes, and snippets.

@ncherro
Last active April 8, 2016 20:06
Show Gist options
  • Save ncherro/0d7909ff05fd93dc350a to your computer and use it in GitHub Desktop.
Save ncherro/0d7909ff05fd93dc350a to your computer and use it in GitHub Desktop.
Add captions with FFmpeg
#!/usr/bin/env bash
FONTPATH="$HOME/PiqueWebSmallCaps.woff"
OUTPUT="$2"
SECOND="This is the
second caption"
ffmpeg -i "$1" \
-vf "[in] \
drawtext=enable='between(t,2,8)': \
fontfile=$FONTPATH: \
text='This is the first caption': \
fontcolor=0xFFFFFFFF: \
fontsize=100: \
shadowcolor=black: \
shadowx=2: \
shadowy=1: \
fix_bounds=true: \
x=(w-tw)/2: \
y=(h-th)/3, \
drawtext=enable='between(t,4.225,16)': \
fontfile=$FONTPATH: \
text='$SECOND': \
fontcolor=0xFFFFFFFF: \
fontsize=100: \
shadowcolor=black: \
shadowx=2: \
shadowy=1: \
fix_bounds=true: \
x=(w-tw)/2: \
y=(h-th)/2, \
drawtext=enable='between(t,10,20)': \
fontfile=$FONTPATH: \
text='This is the third caption': \
fontcolor=0xFFFFFFFF: \
shadowcolor=black: \
shadowx=2: \
shadowy=1: \
fontsize=100: \
fix_bounds=true: \
x=(w-tw)/2: \
y=(h-th)/1.5 \
[out]
" $OUTPUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment