Search google

Google
 

This is the place where I leave my scripts, my useful files, glad to have your suggestions. If you want to make discuss, please contact me at YM id bornbygoogle or my mail bornbygoogle@yahoo.com or simply let ur mail. I'll try to contact as soon as possible :) Nice to see you :D

Monday, July 28, 2008

My bash script : Split media files to multiple parts viewable version 2 !

After a long time using the first version, I realize that it take a long time to finish its task. So I decide to change it. And here is my second version, it's better than the older one.

#!/bin/bash
#This bash script is using to split movie into multiple viewable parts. Give it the execute permission and then enjoy it ;)
#Written by bornbygoogle. Any question please let me know at bornbygoogle@yahoo.com or at hackthefreedom.blogspot.com.

ARGS=2
E_MAUVAISARGS=65

if [ $# -ne "$ARGS" ]
then
echo "Usage: `basename $0` directory_which_content_all_the_film_you_want_to_split time_length_of_each_part_in_seconds"
exit $E_MAUVAISARGS
fi

cd $1
ls | grep avi > 002.txt
sed 's/.avi//g' 002.txt > 001.txt
rm 002.txt
echo "List of films : "
cat 001.txt
i=1
size=1000001
time=0
echo "Start to split !"
cat 001.txt | while read line; do
while [ $size -gt 1000000 ]
do
echo "Episode $i - film $line"
mencoder -ss $time -endpos $2 -ovc copy -oac copy $line.avi -o $line-part$i.avi
echo "Finished split episode $i"
let size=`cat $line-part$i.avi | wc -c`
let i++
let time=$time+$2-10
done;
let i--
rm $line-part$i.avi
let size=1000001
let i=1
let time=0
done
echo "Finished ! Have fun !"
rm 001.txt

No comments:

Convert Megaupload links to Rapidshare links !

If someone want to convert Megaupload to Rapidshare links, please let me know, I'll do it for you ! ( for free, all ). If you want, please send those links to me, with the mail title : Convert to Rapidshare !. My mail is bornbygoogle@yahoo.com. Or YM ID : bornbygoogle.

Nice to help you ! :)