[英]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.
我正在使用带有MediaController的VideoView。 Everything works as expected on my Desire HD and Nexus S (both running Android 2.3.3).
在我的Desire HD和Nexus S(都运行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 . 所有视频均为mp4,采用H.264,720w / 480h,25fps编码。 I have also used H.263(3gp) but with no luck.
我也使用过H.263(3gp),但没有运气。
I want to support as many Android devices as possible. 我想支持尽可能多的Android设备。 At least starting from 2.1
至少从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 : 您可以使用某些第三方媒体库扩展您的应用程序支持的格式,这里是一个很好的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.除了Android平台内置的默认媒体格式外,许多音频和视频编解码器都包含在Vitamio中,其中一些列在下面。
divx/xvid
的DivX / XVID
wmvWMV
flvFLV
tsTS
rmvbRMVB
mkvMKV
movMOV
m4vM4V
aviAVI
mp4MP4
3gp3GP
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: 不应该太难以集成并将其用于您的项目,虽然我不知道它在2.1之类的旧Android设备上运行的性能:
Vitamio provides the similiar interfaces with Android default MediaPlayer framework.
Vitamio提供与Android默认MediaPlayer框架类似的界面。 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.
如果您在项目中使用android.media.MediaPlayer,只需从上面获取vitamio.jar,然后将其添加到项目的libs中,并用io.vov.vitamio.MediaPlayer替换android.media.MediaPlayer的导入。
Hope this help. 希望这有帮助。
Google has a list on there site : http://developer.android.com/guide/appendix/media-formats.html Google在该网站上有一个列表: http : //developer.android.com/guide/appendix/media-formats.html
3GPP & MP4 seem the most compatible 3GPP和MP4似乎最兼容
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. 除非您在应用程序中捆绑解码器,否则TBH直到后来修改Android视频播放兼容性很差。 (I bought a software h264 decoder to fall back upon).
(我买了一个软件h264解码器可以依靠)。 One of the reasons I gave up with game writing for Android , still good for apps revenue though ;-)
我放弃Android游戏写作的原因之一,虽然仍然对应用程序收入有利;-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.