Skip to content

Instantly share code, notes, and snippets.

View breuhan's full-sized avatar

Andy Breuhan breuhan

View GitHub Profile
blueprint:
name: Adaptive Motion-activated Light
description: Yet Another Motion Automation
domain: automation
source_url: https://gist.github.com/cylonbrain/3299596e288d215ea4a65606f6029b97
input:
motion_entity:
name: Motion Sensor
selector:
entity:
@breuhan
breuhan / insert_timecode.sh
Created March 4, 2016 17:27
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}"
@breuhan
breuhan / gist:8197614
Last active January 1, 2016 20:29
FreeBSD Base install
#Compat linux
kldload linux
pkg install linux_base-f10
echo linux_enable=\"YES\" >> /etc/rc.conf
#Base
pkg install bash curl wget git netatalk3 avahi
#linproc to fstab
echo "linproc /compat/linux/proc linprocfs rw 0 0" >> /etc/fstab
# Timecode burn with ffmpeg
# ffmpeg must be configured with --enable-libfreetype
# box=1 - tells ffmpeg to draw a box around the text
# boxcolor - format is 0xRRGGBB[AA]
ffmpeg -i video.mov -vcodec libx264 -cmp 22 -vf "drawtext=fontfile=DroidSansMono.ttf: timecode='09\:57\:00\:00': r=23.976: x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000099" -y output.mov