I am looking into writing a small AI that can convert videos. The main goal for the program would be to convert videos from any major format into a flash .flv file (using ffmpeg or mencoder, depending on the source format) of the smallest possible size while maintaining a certain level of video quality. I have several ways in which I believe this can be accomplished, but the main thing I am lacking is a tool that will quantitatively measure a video for quality based on resolution, bitrate, etc. I don't care what the scale is based on, as long as it is consistent.

Does anyone know of such a benchmarking tool for Linux?