Jun 30 2012

bash: if else with floats in bash , for i s, arrays

arr=(“as” “df” 5 kkk “uz z t”);
for ((i=0; i<10; i++));
do echo ${arr[$i]};


uz z t

calc if else with floats
a=1.6;b=1.7;if [[ $a < $b ]];then echo $a smaller than $b;fi numbers: i=0 $((i+2)) >> 2

Jun 9 2012

time lapse with ffmpeg

create single images every 25 pic:
ffmpeg -i $1 -r 1 -f image2 out/%05d.png

assemble back all together:
ffmpeg -i out/%05d.png -sameq $2

and as bash script

#create a dir named out by hand, now to lazy
rm out/*
#every 250 /300 one image (10 sec approx)
ffmpeg -i "$1" -r 0.1 -f image2 out/%05d.png
#compile all together with 30fps
ffmpeg -i out/%05d.png -qscale 0 -r 30 "$1.mov"

#this are some useful commands; concate mov's together
echo "mencoder.exe -oac copy -ovc copy -idx -o outall.mov o2.mov o3.mov"

# ffmpeg -i wetter_dortmund.mov -vcodec libx264 -crf 23 -preset medium -profile:v high -level 41 -pix_fmt yuv420p -maxrate 3020k -b 3020k -bufsize 1835k -y fenter_oktay_dortmund.mkv

echo "ls *.mov | while read line;do echo ./timelapse.sh $line;done > st.sh"

Jun 9 2012

rename 00123.png to 00001.png

a=0;ls | while read line; do a=$((a+1)); mv $line `printf “%05d.png\n” $a`;done

Jun 7 2012

multiple VOB file with multiple audio channels

multiple VOB file with multiple audio tracks into avi
we want to have only VOB 4 to 7

for i in `seq 4 7`; do c=`ls VTS_0$i*| grep VOB| grep -v _0.VOB | tr “\n” ” “`;cat $c > $i.VOB;done

for i in `seq 4 7`;do ffmpeg -i $i.VOB -vcodec libxvid -y -acodec libmp3lame -ac 2 -map 0:0 -map 0:2 -map 0:1 -vb 2M -ar 44100 -ab 128 $i.avi;done