FFMPEG视频转换为FLV而不会失去质量?

I am using below command in php for converting all videos to flv. It's working proper but quality is bad after conversion. I want to retain quality after conversion.

$wide=$file['video']['resolution_x'];
$tall=$file['video']['resolution_y']; 

exec("ffmpeg -i test.anyformate  -ar 22050 -ab 32 -f flv -s ".$wide."x".$tall." flvideo/$vid.flv");

I believe you can do this, but you have to compile FFmpeg and x264 (codec) yourself and achieve the lossless conversion like this:

ffmpeg -i input.avi -acodec libfaac -ab 96k -ac 2 -vcodec libx264 -vpre hq -crf 22 -threads 0 output.flv

The steps are detailed here: http://ubuntuforums.org/showthread.php?t=1249838&p=7850605#post7850605