#!/bin/bash
#Simple video/image formatting/transcode script for Sansa FuzeV2 for rockbox
#Made by: Jennifur "bunnytaur" Pawson email: bunnytaur@gmail.com
#TODO:
#File names with spaces don't work. IDK how to fix that
#Other various bugs
#MOVIES (Common formats?)
#Convert any movie to a mpeg2 with mp3/mpg2 audio
#Add the extensions to what ever you want to
#It requires mplayer/mencoder. I may change/add support for ffmpeg if i feel like it
count=`ls | wc -l`;
filen=0;
for file in *{.mpg,.mpeg,.mp2,.mp4,.avi,.xvid,.mkv,.wmv,.rmvb};
do filen=`expr $filen + 1`;
mencoder "$file" -of mpeg -oac lavc -lavcopts acodec=mp2:abitrate=96:vmax_b_frames=16:vb_strategy=2 -af resample=44100:0:0 -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=500 -vf scale=220:176,harddup -ofps 25 -o $file-2.mpg;
echo "Done";
done;