I may have talked about this before, but I just wanted to spent a bit more time on it. I hear people complain all the time that they do not have enough space to hold all of their allegedly legitimate movie backups. I am concerned with space also but just for the movies we make ourselves. They are usually .avi format. Usually it takes two commands to get the files to the .ogv (ogg video) format. The .ogv formatted files can be at least 1/3 smaller than the original .avi file. Not only do the .avi files consume space but take a lot longer to upload. Usually it takes two commands to get the job done. I made a special command file to deal with converting one file to save a log of typing.

sv.sh

echo Squeezing video of $1.avi
echo --------------------------------------------------
echo Going from avi to mpeg.
ffmpeg -i $1.avi -b 100000k -ab 128k -ar 44100 $1.mpeg

echo Avi to mpeg done.
echo Going from mpeg to ogv
ffmpeg2theora $1.mpeg

echo Removing unneeded mpeg file to free space.
rm $1.mpeg

echo Done
echo ----------------------------------------------------
echo List ogv file
ls -al $1.ogv
echo ====================================================

$ chmod +x sv.sh

To compress a file named p,avi, you would use:

$ ./sv.sh p

But then I thought about it and wanted to automatically do several files at once say late at night so I came up with this:

smv.sh

for f in *.avi
do
clear
echo "Processing $f file..."
# take action on each file. $f store current file name
echo
echo Squeezing video of $f
echo --------------------------------------------------
echo Going from avi to mpeg.
filename=${f%.*}
echo ${filename}
ffmpeg -i $f -b 100000k -ab 128k -ar 44100 ${filename}.mpeg

echo Avi to mpeg done.
echo
echo Going from mpeg to ogv
ffmpeg2theora ${filename}.mpeg

echo Removing unneeded mpeg and avi file to free space.
rm ${filename}.mpeg
# uncomment the following only if the avi files are duplicates..
# rm $f

echo Done
echo ----------------------------------------------------
echo List ogv file
ls -al ${filename}.ogv

echo appending filename to list of files converted
echo ${filename} >> filesdone
echo ====================================================
done

To run /path/to/command five minutes after midnight, every day, enter:
# crontab -e

5 0 * * * /path/to/smv.sh

Note: I would only put a copy of the avi files in the working directory. The avi files could then be deleted so they would not be reconverted the next night. I did not add the deletion command to the batch file for safety reasons.

——–

Testing simple pwm (pulse width modulation) routines This basically allows for a character to be on the screen longer and longer. The basic idea could easily be adapted for led’s and motor control.

cls
for x = 1 to 50
for y =1 to x
locate 1,1
?"1";
for z = 1 to 500000 step 5
next z
next y
for a = 1 to 50 -x
locate 1,1
?" ";
for z = 1 to 500000 step 5
next z
next a
next x

Since the parallel port is slower than writing to the screen, turning off and on leds has a more profound affect. Leds with corresponding resistors were hooked to d0 through d7 on the parallel port and ground to pin 18 for this test.

cls
for x = 1 to 50
for y =1 to x
locate 1,1
rem ?"1";
out 888,255
for z = 1 to 500000
next z
next y
for a = 1 to 50 -x
locate 1,1
rem ?" ";
out 888,0
for z = 1 to 500000
next z
next a
next x
out 888,0

——–

Mini-soapbox:
One of the things I probably harp on too much is to use linux with older machines. I do this basically because of my concern for the environment. There is nothing wrong in using linux for brand new equipment. If you know the particular distro will support your future hardware and if you have the spare clams to get a new system, then by all means go out and get it. If you are into video, you certainly want to consider newer equipment.

——

A few untested ideas for circuits: (Build and use at your own risk.)

Rc car control:

Possible adapter for usb parallel cable to do home automation:

Possible i2c parallel port interface:

——

One last script. Gets weekly horoscope

# useage: ./ghpw1 SIGN
#         ./ghpw1 VIRGO
# Get weekly horoscope
hsign=$1
date +%D
echo -n "Today's horoscope for:"
lynx -width 1000   -dump "http://www.creators.com/lifestylefeatures/horoscopes/holiday-mathis-weekly.html" > hscope ; cat hscope | grep $hsign

Good day!

Advertisements