FFMPEG video to FLV conversion optimization

ffmpeg

Would anyone have any tips on optimizing video to FLV conversion using ffmpeg so I would get a medium quality video which is not very large?

I have a video site where users can upload videos which will be converted to FLV and displayed. Those videos are shown at the size 420×350. I'm using FFMPEG to convert then to FLV, through the following command:

ffmpeg -i $in $out

I find the result to be pretty low quality and whenever I try to change settings, the output will be a very large file. For instance, I've tried this:

  ffmpeg -i $in -sameq -ar 11025 -ab 32 -deinterlace -nr 500 -r 20 -g 500 -s 420x350 -aspect 4:3 -me_range 20 -b 270k -f flv -y $out

Best Answer

For ffmpeg, I always recommend using -sameq. During testing you can create a smaller test source. I assume 420x350 is lower resolution than the source. Try creating a source matching this to speed up testing.

ffmpeg -i "$in" -sameq -s 420x350 -an "$testin"

Where $testin is a filename with the same extension as $in. ffmpeg should keep the video codec and container the same, but drop the audio stream and drop the resolution. This will speed up testing since the source video will be a little smaller and you can just focus on making the codec conversion work well. I can't find -me_range documented in my ffmpeg. I would focus on playing with different values of -b and -r and use of -sameq until you get an output file size and quality you want.

ffmpeg -i "$testin" -sameq -r 20 -b 270k "$out"
Related Question