While working on Gamevue (Gamevue.net), I had to find a high-quality compression for FLV that would stream with the lowest bandwidth possible.
First of all, http://ubuntuforums.org/showthread.php?t=786095 is a great tutorial for installing FFMPEG. In my case, it was actually installed on Debian through SSH.
Also, http://www.kilobitspersecond.com/2007/05/24/ffmpeg-quality-comparison/ does a very good job of looking into the different qscale options.
For a video, I chose my friend Ron’s video named “potter” which is about 5 minutes long, 720p, and around 450MB in size before any sort of compression. Note that this takes a while to convert if you don’t have a very fast server.
The code:
ffmpeg -i /path/potter.mp4 -qscale {QSCALE} -ar {ARATE} -ac 2 -acodec {ACODEC} -vcodec {VCODEC} -ab {ABITRATE} -f flv -s 1280x720 /path/potter_{ARATE}_{ABITRATE}_720p.flv
After a few tests with different video codecs, I chose libx264. After messing with a different video from Ron, I was very happy with the results.
Before conversion: http://localhostr.com/files/F6c63r0/capture.png (29.3 MB)
After conversion: http://localhostr.com/files/RufUdEt/capture.png (6.7 MB)
The converted file’s size was only 23% of the original file’s size with an audio rate of 22050 Hz, video codec libx264, and the audio codec libfaac.
More Tests (audio)
I tried 22050 and 44100 as the audio rates and 196k and 256k as the audio bit rates and LAME MP3 and AAC as the audio codecs.
The results were quite similar to each other.
gamevue:/path# du potter* 121596 potter_22050_196k_720p.flv 124824 potter_22050_196k_LAME_720p.flv 121596 potter_22050_256k_720p.flv 124824 potter_22050_256k_LAME_720p.flv 124528 potter_44100_196k_720p.flv 126016 potter_44100_196k_LAME_720p.flv 124528 potter_44100_256k_720p.flv 128408 potter_44100_256k_LAME_720p.flv
The quality difference in audio was not very much going from LAME to AAC, but it did shave off almost 4MB on the higher quality audio file.
Audio Codec chosen: AAC (libfaac)
Video Codec chosen: x264 (libx264)
Audio Rate chosen: 44100
Audio Bit Rate chosen: 256k
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.