12 February 2011

Android Video Encoder

I wasn’t having much luck finding an easy way to encode videos for viewing on my phone, so I cooked one up. I followed the instructions for ffmpeg as listed here, and wrote a Ruby wrapper that detects the dimensions of the video and scales them down to the right size for you phone.

The script is simple so it can be easily edited to include your preference of encoding switches to ffmpeg. It’s using the h264 codec, which is a bit slower to encode but makes beautifully smooth high quality videos and a fraction of the size of quicker methods.

Grab the script at Github: https://gist.github.com/823686