什么视频格式可以在所有 Android 设备上播放?
Android 可以播放各种视频格式,但我需要选择一种适用于所有设备的格式。
所有 Android 2.3 设备都支持完全相同的格式吗?即,如果该格式可以在模拟器中播放,是否意味着它也可以在所有硬件上播放?或者不同的设备是否支持不同的格式,具体取决于它们拥有的解码器芯片?
如果它们都相同,那么显然最好的格式是高比特率和分辨率的 H.264。如果不是,那么可以在 90% 的设备上播放的最佳编解码器/比特率/分辨率是什么? Google 是否提供某种方式来查询设备的视频功能并选择合适的格式?
Android can play a variety of video formats, but I need to choose one format that will work on all devices.
Do all Android 2.3 devices support exactly the same formats? i.e. if the format will play in the emulator, does that mean it will also play on all hardware? Or do different devices support different formats depending on what decoder chips they have?
If they are all the same then obviously the best format is H.264 at a high bitrate and resolution. If not, then what is the best codec/bitrate/resolution that will play on 90% of devices? Do Google provide some way of querying the device's video capabilities and choosing an appropriate format?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
经过在很多设备上进行测试(对于一个非常流行的应用程序的视频闪屏)。我的建议是:
注意:我的视频没有声音!
但即使采用此建议,某些视频仍因其分辨率而无法播放。
所以我创建了一个棘手的代码:我将所有密度的视频嵌入到我的
raw
文件夹中,向我的VideoView
添加了一个setOnErrorListener
,然后我每次发生错误时尝试启动较小的视频。这是我的原始文件夹:
这是我的java代码:
After testing on a lot of devices(for the video splashscreen of a very popular app). My recommendations are:
Note:My video has no sound!!
But even with this recommendation, some videos will not work because of its resolution.
So i create a tricky code: I embed all my videos for all the density in my
raw
folder, added ansetOnErrorListener
to myVideoView
and i try to launch a smaller video each time an error occured.This is my raw folder:
and this is my java code:
该模拟器对编解码器的测试很差,并且在某些方面无法正常工作。是的,设备制造商可能会在他们的 Android 版本中添加额外的编解码器。不过,您可能需要查看 Android 兼容性 并阅读有关制造商对设备上的 Android Market 的要求的更多详细信息,请参阅兼容性定义文档。不幸的是,快速浏览一下它并没有说明任何有关最低比特率的信息,因此根据您愿意支持的 Android 版本,您可能会遇到问题。
The emulator is a poor test of codecs and isn't functional in a few areas. And yes device manufacturers may add additional codecs to their build of Android. However you may want to check out the Android Compatibility and read the Compatibility Definition Document for more details as to what is required by the manufacturer get Android Market on the device. Unfortunately a quick look through it doesn't state anything about minimum bitrate so depending on how old a version of Android you are willing to support you may have issues there.
http://developer.android.com/guide/appendix/media-formats.html
相信大家可以通过MediaPlayer类来看看具体的功能。
http://developer.android.com/guide/appendix/media-formats.html
I believe you can use the MediaPlayer class to see specific capabilities.