简体   繁体   English

Android:我应该使用什么视频格式/编码来支持大多数Android设备

[英]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
wmv WMV
flv FLV
ts TS
rmvb RMVB
mkv MKV
mov MOV
m4v M4V
avi AVI
mp4 MP4
3gp 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: 不应该太难以集成并将其用于您的项目,虽然我不知道它在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.

相关问题 什么视频格式将在所有Android设备上播放? - What video format will play on all Android devices? 在什么设备上使用android.support.v4.os类? - For what devices do I use this android.support.v4.os classes? 在Android中支持编码/解码视频文件 - Support of encoding/Decoding video files in Android 当我定位较旧的Android设备时应该使用什么版本的Google API? - What version of Google APIs should I use when I target older Android devices? Android opengl es 2.0-我应该使用哪种模型格式以及应该创建自己的解析器 - Android opengl es 2.0 - what model format should i use and should i create my own Parser 我应该使用什么 package 来替换最新 AndroidStudio 中的“android.support.test.rule.ActivityTestRule”? - What package should i use to replace "android.support.test.rule.ActivityTestRule" in the newest AndroidStudio? 我应该如何选择在Web,Android和iOS上播放的视频格式? - How should I choose a video format to be played on Web, Android & iOS? 我应该为Android Studio项目使用哪种编码? - Which encoding should I use for my Android Studio project? 什么设备支持Android传感器批处理? - What devices support Android Sensor Batching? 我应该使用最新的android studio版本吗? - should I use the most recent android studio version?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM