We're trying to build a php based video sharing site that allows users to upload their own content.
We need to convert all these videos into a medium-quality mp4 video file for eventual streaming through FlowPlayer.
Our code is something like this (example for flv):
system("ffmpeg -i $vidPath -pass 1 -ab 64k -ar 44100 -ac 1 -vcodec flv -b 1500k -cmp 3 -subcmp 3 -mbd 2 $flvPath");
The problem is that this converts any type of 1 minute video into a 10 MB file. If its a high quality 1 minute video, that gets converted to a 10 MB file - which is great. However, if its a low-quality video, say of just 2 MB, it will still get converted to a 10 MB file!!
What strategy / method should I adopt so that uploaded videos are "upper bound" in size, but lower quality videos of the same length dont get "inflated" to the same size!