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
01 | echo Squeezing video of $1.avi |
02 | echo -------------------------------------------------- |
03 | echo Going from avi to mpeg. |
04 | ffmpeg -i $1.avi -b 100000k -ab 128k -ar 44100 $1.mpeg |
07 | echo Going from mpeg to ogv |
10 | echo Removing unneeded mpeg file to free space. |
14 | echo ---------------------------------------------------- |
17 | 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
04 | echo "Processing $f file..." |
05 | # take action on each file. $f store current file name |
07 | echo Squeezing video of $f |
08 | echo -------------------------------------------------- |
09 | echo Going from avi to mpeg. |
12 | ffmpeg -i $f -b 100000k -ab 128k -ar 44100 ${filename}.mpeg |
16 | echo Going from mpeg to ogv |
17 | ffmpeg2theora ${filename}.mpeg |
19 | echo Removing unneeded mpeg and avi file to free space. |
21 | # uncomment the following only if the avi files are duplicates.. |
25 | echo ---------------------------------------------------- |
29 | echo appending filename to list of files converted |
30 | echo ${filename} >> filesdone |
31 | echo ==================================================== |
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
Post a Comment