Skip to content

Instantly share code, notes, and snippets.

# ./motion.conf
#
# This config file was generated by motion 3.2.12
############################################################
# Daemon
############################################################
# Start in daemon (background) mode and release terminal (default: off)
1
00:00:00,000 --> 00:00:00,999
Mon 2015-08-24 00:00:00
2
00:00:01,000 --> 00:00:01,999
Mon 2015-08-24 00:00:01
3
00:00:02,000 --> 00:00:02,999

####Commands to train Tesseract for Envy Code R font

####Usage

Before running the commands, use jTessBoxEditor to generate the tiff/box file pair and place it in the script folder. Training text can be generated with the following command line and then used in jTessBoxEditor:

for i in {1..200}; do for j in ":" 0 1 2 3 4 5 6 7 8 9; do echo -n $j >>training_text.txt; done; done

####Notes

#!/bin/bash
find ./motion/ -type f -iname "*.jpg" -print | while read file
do
image=$file
convert -extract 190x56+700+620 -fuzz 20% -fill black +opaque yellow $image extract_replace.png
convert -colors 2 -threshold 50% -negate extract_replace.png extract_mono.png
timestamp=$(tesseract -psm 7 -l ecr extract_mono.png stdout |tr ":" "-")
cp $image ./motion/$timestamp.jpg
echo $image copied to $timestamp.jpg
!#/bin/bash
find . -type f -iname "*.avi" -print | while read line; do
duration=$(ffprobe -i $line 2>&1 > /dev/null |grep Duration |cut -d',' -f1 |cut -d' ' -f4)
framerate=$(ffprobe -i $line 2>&1 > /dev/null |grep Stream |cut -d',' -f4 |cut -d' ' -f2)
bitrate=$(ffprobe -i $line 2>&1 > /dev/null |grep Duration |cut -d',' -f3 |cut -d' ' -f3-)
modified=$(stat $line |grep Modify |cut -d' ' -f3 |cut -d'.' -f1)
file=$(echo $line | cut -d'/' -f2)
echo $file,$framerate,$bitrate,$duration,$modified >> times_temp1.csv
done
#!/bin/bash
interval=$(printf "%s" "$1"|tr -dc '[:digit:]')
half_interval=$(expr $interval \/ 2)
interval=$(expr $half_interval \* 2)
interval_text=$(date -u -d "@${interval}" "+%T")
date_text=$(pwd |rev |cut -d"/" -f1 |rev |cut -d" " -f1)
full_date_text=$(pwd |rev |cut -d"/" -f1 |rev)
mkdir ${date_text}_events