My old pads.... and squeeze a video.


Hope to have an Ipad2 soon to show.

Squeeze a video.
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
01echo Squeezing video of $1.avi
02echo --------------------------------------------------
03echo Going from avi to mpeg.
04ffmpeg -i $1.avi -b 100000k -ab 128k -ar 44100 $1.mpeg
05
06echo Avi to mpeg done.
07echo Going from mpeg to ogv
08ffmpeg2theora $1.mpeg
09
10echo Removing unneeded mpeg file to free space.
11rm $1.mpeg
12
13echo Done
14echo ----------------------------------------------------
15echo List ogv file
16ls -al $1.ogv
17echo ====================================================
$ 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
01for f in *.avi
02do
03clear
04echo "Processing $f file..."
05# take action on each file. $f store current file name
06echo
07echo Squeezing video of $f
08echo --------------------------------------------------
09echo Going from avi to mpeg.
10filename=${f%\.*}
11echo ${filename}
12ffmpeg -i $f -b 100000k -ab 128k -ar 44100 ${filename}.mpeg
13
14echo Avi to mpeg done.
15echo
16echo Going from mpeg to ogv
17ffmpeg2theora ${filename}.mpeg
18
19echo Removing unneeded mpeg and avi file to free space.
20rm ${filename}.mpeg
21# uncomment the following only if the avi files are duplicates..
22# rm $f
23
24echo Done
25echo ----------------------------------------------------
26echo List ogv file
27ls -al ${filename}.ogv
28
29echo appending filename to list of files converted
30echo ${filename} >> filesdone
31echo ====================================================
32done
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.

Comments

Popular posts from this blog

Guiless?

Web.com and Network Solutions, the Walmart of the internet.

MSOffice vs Libreoffice