Encoding mp4's to play on android phones....

Hi,
I’m working on a project that needs video to be playable on android phones. I’d rather fix the video format than make the user download other video playing software.

Here are videos that work:
http://www.archive.org/details/more_animation

The 512kbps video (424x240) works:

The other MPEG4 video (480x272) doesn’t work…

This one also works: (480x270)
http://mediaelementjs.com/media/echo-hereweare.mp4

I’m using VidCoder and Handbrake to encode the videos and have researched a lot about them. I’ve tried resizing the videos to the sizes that work but it doesn’t work.

The android phone says:
“Sorry, this video cannot be played.”

It may be that the problematic one has different compression or keyframe settings, or some such. There’s a free utility you can get called gspot that will allow you to scrutinise the codec and settings used for a video that works - you should then be able to replicate those settings when you transcode the problem file._

The 512k video (the one that works), the video stream uses the h264 codec.

The other one (that doesn’t work) uses the MPEG4 video codec.

It might just be that. Are you using a Mac? If so, it may be better for you to use ffmpeg directly from the command line rather than via HandBrake.

I don’t have access to an android phone at the moment, but I do have access to android emulators which are part of the android SDK. The videos that worked originally on the phone also work (well the audio does) and the ones that didn’t work don’t work on the emulator. I found this:
http://developer.android.com/guide/appendix/media-formats.html#recommendations
It says “For 3GPP and MPEG-4 containers, the moov atom must precede any mdat atoms.”

I found that this can be done using mp4box… the command is:
mp4box -hint filename.mp4
Then the videos started working on the emulator (well the audio did at least).

I know when I recode video for my Android phone I have to use the H.264 codec in a MP4 container, and put it to a specific screen resolution (384x288). I use Oxelon for conversion.

I supply a powerful MP4 to Android converter-Avdshare Video Converter, which can convert MP4 to Android supporting format like MPEG-4 or H.264 AVC, thus play MP4 on Android phones or tablets.