#!/bin/bash
#
# video2flv4all - Create flash videos (<videoname>.flv) from all videos of a certain type in the current directory
# for use with Coppermine.
#
# Requirements: ffmpeg must be installed.
#
# Place this file in a directory that is in your $PATH to executables such as /usr/local/bin
# Then, chmod a+x video2pic
#
#
# Run this script from within the directory where the videos reside with the command: "video2flv4all".
#
#
# Get data from terminal
echo -n "Enter video file types to convert (flv, video. mov...): ";read filetype;
echo -n "Enter Bitrate (Kbits/sec): ";read bitrate
echo -n "Enter Framerate (fms/sec): ";read fps
echo -n "Enter Audiorate (22050 or 44100): ";read audiorate
#
for file in *.$filetype;do
	# Extract filename without extension
	filename=${file:0:(${#file})-4};
	echo;echo;echo Converting $file to $filename.flv;echo;
ffmpeg -i $file -b $bitrate"k" -r $fps -ar $audiorate -f flv $filename.flv;
done
echo;
echo "Complete!...";
