Driveway Cam

bash script to convert bvr files

to Mp4

I was looking for a method to convert .bvr files to mp4 without using up my Blue Iris camera servers processor. Currently I’m running an 4th gen i5 processor.  So it is not a workhorse compared to some other machines on my network. 

Note: This is a work in progress. 

If there is a better way, shoot me an email: james @ strickstuff [dot] com

 

 

#!/bin/bash
#
# Script to convert .bvr files to mp4 using ffmpeg
# NOTE: this is still a work in progress
# I am still working on the ffmpeg switches
# to make this work better. But it works fine
# as is.
#
#
# First pass & remove files as you convert them. 
##!/bin/bash
for vid in *.bvr; 
do ffmpeg -probesize 42M -framerate 30 -i $vid -vcodec copy -an -bsf:v h264_mp4toannexb "${vid%.*}.h264" && rm $vid;
done
#
# Second pass, 
#
for h264 in *.h264;
do ffmpeg -i $h264 "${h264%.*}.mp4" && rm $h264;
done
#
# This just merges all mp4s in the directory into a single file
# remove (or comment out) if not needed.
#
[ -e list.txt ] && rm list.txt
for f in *.mp4
do
echo "file $f" >> list.txt
done
ffmpeg -f concat -i list.txt -c copy joined-out.mp4 && rm list.txt

Stumbled upon this cartoon:
Paper Airplanes

Thought this was hilarious!!!  Of course, since I’m not much of a C++ programmer, I would do something like this:

Sub airplanes()

Range("A1").Value = "I will not throw paper airplanes in class"
Range("A1").Copy
Range("A2:A500").PasteSpecial

End Sub

throw this in a spreadsheet then email it to the teacher!!! Ok, so this method wouldn’t be as cool as the pic, but it would work and save time! Wonder how you could do this in BASH…

Recently got tired of having bookmarks on my my laptop and not on my desktop, podcasts on my desktop but not on my laptop and so on and so forth. So, I decided to use rsync to sync the two. I use my laptop most, so I started with that. I didn’t want to rsync my entire /home/user/ directory, so I just chose to sync the apps that I wanted to be the same on both computers. So, I just wrote a simple bash script to sync the two. First, I got rid of the passwords when I rsync or ssh to the desktop. I used the command below.

ssh-keygen -t rsa

Do not enter password when prompted. from there,

cd ~/.ssh/ && cp id_rsa.pub laptop.key

Then put that key into authorized_key file on the remote computer. I had an nfs share of my home computer, so I just did it that way. You could use FTP, Thumbdrive, etc.

cat laptop.key >> authorized_keys

Once that is complete, repeat for both machines. You should then have 2 way passwordless communication via rsync & ssh.

here’s the script I wrote.

#-------------------------------
# Laptop / Desktop sync script
#
# gi_james@strickstuff.com
#-------------------------------

# Declare Variables
amark="/home/james/.kde3.5/share/apps/amarok/"
kopet="/home/james/.kde3.5/share/apps/kopete/"
firefx="/home/james/.mozilla/"
thunder="/home/james/.thunderbird/"
school="/home/james/school/"

# Begin sync ops
echo "Syncing Amarok"
rsync -arvuz $amark compaq:$amark
echo "Syncing Firefox"
rsync -arvuz $firefx compaq:$firefx
echo "Syncing Thunderbird"
rsync -arvuz $thunder compaq:$thunder
echo "Syncing Kopete"
rsync -arvuz $kopet compaq:$kopet
echo "Syncing School Folder"
rsync -arvuz $school compaq:$school

echo " "
echo " "
echo " "
echo "DONE!!!!!!!!!!!!!"

This script will sync the directories in the #delare variables section. Change those around accordingly. I know there are other methods, but this method is good enough for what I want to do. Please feel free to email me with a better method. I’m certainly not the most proficient bash scripter.

Oh, one more thing, before I started, I edited /etc/hosts and added the hostname of all computers on my network. That way, all I have to do is type ssh computername instead of ssh ipaddy and no password is needed.