Skip to content

Instantly share code, notes, and snippets.

@breuhan
Created March 4, 2016 17:27
Show Gist options
  • Select an option

  • Save breuhan/139d7582df2bb97b1b44 to your computer and use it in GitHub Desktop.

Select an option

Save breuhan/139d7582df2bb97b1b44 to your computer and use it in GitHub Desktop.
Intert timecode into multiple movies
#!/usr/local/bin/bash
for i in *.MP4; do
frame_rate=25
#$(ffprobe -i -show_streams 2>&1|grep fps|sed "s/.*, \([0-9]*\) fps,.*/\1/")
#clipname=${(basename "$i")/\.*/}
#ffmpeg -i "$i" "${i/.MP4/_tc.mov}"
timecode="${i:7:2}\\:${i:10:2}\\:00\\:00"
echo $timecode
ffmpeg -i "${i}" -copyts -vcodec libx264 -b:v 20000k -an -vf drawtext="fontfile=/usr/local/share/munin/DejaVuSansMono.ttf:rate=${frame_rate}:timecode=\\'${timecode}\\':textfile=textfile:fontsize=18:fontcolor=\\'white\\':boxcolor=0x000000AA:x=w-(tw+10):y=h-(th+10)" "${i/.MP4/_tc.mp4}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment