7

I am about to encode some of my videos so that they can be played on android devices?

what is the most compatible container, codec and dimension for android devices. thanks!

4

The Android Developer Guide covers this pretty thoroughly. They have all the supported formats as well as recommendations. I would additionally recommend using the same resolution as your screen if your device can handle it, that will much improve the quality.

  • 1
    ok thanks, so i am trying to encode it to h263 using ffmpeg but my phone still says: this video can not be played – clamp Jun 12 '11 at 14:22
  • @clamp What device do you have? – Matthew Read Jun 12 '11 at 16:43
  • HTC Desire with android 2.2 – clamp Jun 12 '11 at 17:07
2

When I encode movies using Handbrake or DVDFab, I choose the "iPad" option, which create an m4v with h.264 and AAC (I think). Yes, this feels like sacrilege, but I just ignore the voices in my head. ;)

On XOOM, this plays fine. To keep the file size down, I take the audio down to stereo @ 44.1khz and 96kbps and the video rate to 1200kbps, while still maintaining 720p. This seems to work out alright and most 2 hour movies are in the 1 to 1.5GB range.

0

Based on another answer on the "Optimum video codec for low end Android phones" question, here is what I used:

ffmpeg -i input_video.mp4 \
    -sws_flags lanczos+accurate_rnd \
    -vf "scale=iw/2:-1" \
    -c:v libx264 \
    -crf 23.0 \
    -preset veryslow \
    -profile:v baseline \
    -tune fastdecode \
    -strict -2 \
    output_video.mp4

Note that I didn't set a specific resolution, just halved the original video's via the -vf "scale=iw/2:-1" option which worked well for my case, but you can change that as documented on the "Scaling (resizing) with ffmpeg" wiki page.

The H.264 Encoding Guide may also be useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.