Skip to content

Instantly share code, notes, and snippets.

@theapi
Created April 26, 2013 22:25
Show Gist options
  • Save theapi/5470861 to your computer and use it in GitHub Desktop.
Save theapi/5470861 to your computer and use it in GitHub Desktop.
Watch the samba share for new videos with the .264 extension then mux them into a .mkv file playable by video players.
#!/bin/sh
# apt-get install inotify-tools
# apt-get install mkvtoolnix
WATCHED_DIR="/mnt/sda1/cctv/videos"
echo "Watching directory: $WATCHED_DIR for new files"
inotifywait -m -q -e create -r "$WATCHED_DIR" --format "%w%f" |
while read file
do
case $file in
*264)
videoin="$file"
videoout="$file".mkv
mkvmerge -o $videoout --forced-track 0:no -d 0 -A -S -T --no-global-tags --no-chapters $videoin --track-order 0:0
rm $file
;;
*) # do nothing
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment