简体   繁体   中英

Android: What video format/encoding should I use to support most of the android devices

I have a collection of video clips which user should be able play from inside my app (not external video player). I am using VideoView with MediaController. Everything works as expected on my Desire HD and Nexus S (both running Android 2.3.3). However they won't play on order devices. I get "Sorry, this video cannot be played" error message.

All videos are mp4, encoded with H.264, 720w/480h, 25fps . I have also used H.263(3gp) but with no luck.

I want to support as many Android devices as possible. At least starting from 2.1

Does any one had the same problems? What videos are you using in your apps? Thanks for help!

You can use some third part media library extend your app's supported format, here is a good one Vitamio :

Media formats
Many audio and video codecs are packed into Vitamio beside the default media format built in Android platform, some of them are listed below.

divx/xvid
wmv
flv
ts
rmvb
mkv
mov
m4v
avi
mp4
3gp

Shouldn't be too hard to integrate and use it into your project, though I don't know its performance running on old Android device like 2.1:

Vitamio provides the similiar interfaces with Android default MediaPlayer framework. If you're using android.media.MediaPlayer in your project, just grab the vitamio.jar from above, then add it to your project's libs, and replace the import of android.media.MediaPlayer with io.vov.vitamio.MediaPlayer.

Hope this help.

Google has a list on there site : http://developer.android.com/guide/appendix/media-formats.html

3GPP & MP4 seem the most compatible

It also lists the mandatory profiles so you should be able to get something going.

TBH until later revisions of Android video playback compatibility is poor unless you bundle a decoder in your app. (I bought a software h264 decoder to fall back upon). One of the reasons I gave up with game writing for Android , still good for apps revenue though ;-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM