无法在 android 中播放从 iphone 上传的视频
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23627873/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't Play video in android uploaded from iphone
提问by user2524618
I have upload and play videos on both Android and iPhone devices but video uploaded from iPhone is not working on Android.it's not play in android video player. It's give me error message
我已经在 Android 和 iPhone 设备上上传和播放视频,但从 iPhone 上传的视频在 Android 上不起作用。它不能在 android 视频播放器中播放。它给了我错误信息
"sorry this video can not be played"
“抱歉,这部影片无法播放”
video is in mp4 format.
视频为 mp4 格式。
回答by Biraj Zalavadia
Yes, That's right.
恩,那就对了。
It happens because the android support limited codecs in-built like mp3,mp4,mpeg.
发生这种情况是因为 android 支持有限的内置编解码器,如 mp3、mp4、mpeg。
While iphone support most of codecs.
虽然iphone支持大多数编解码器。
What is the way to resolve this?
解决这个问题的方法是什么?
MP4 for video and MP3 for audio are widely accepted and work on both platforms.
用于视频的 MP4 和用于音频的 MP3 被广泛接受并在这两个平台上工作。
So you need do some stuff at the server. Implement the ffmpeg library that will convert all the videos to MP4 and audio to MP3.
所以你需要在服务器上做一些事情。实现将所有视频转换为 MP4 并将音频转换为 MP3 的 ffmpeg 库。
We are doing same mechanism to resolve this issue.
我们正在做同样的机制来解决这个问题。
Find FFMPEG implementation for PHP Hereand
在此处查找 PHP 的 FFMPEG 实现和
Command to convert all videos to MP4 HereHope this helps you.
命令将所有视频转换为 MP4在这里希望这对您有所帮助。
Thanks.
谢谢。
回答by Dmitry
If it is mp4, then you need to check what codecs are used. iPhone usually encodes everything in h264, however, there are different profiles of h264 and high profiles might not be supported on Android, because they are more complex for decoding.
如果是 mp4,则需要检查使用的编解码器。iPhone 通常以 h264 编码所有内容,但是,h264 有不同的配置文件,Android 可能不支持高配置文件,因为它们的解码更复杂。
Even apple says in their documentation:
甚至苹果在他们的文档中说:
H.264 Baseline Level 3.0, Baseline Level 3.1, Main Level 3.1, and High Profile Level 4.1.
iPad, iPhone 3G, and iPod touch (2nd generation and later) support H.264 Baseline 3.1. If your app runs on older versions of iPhone or iPod touch, however, you should use H.264 Baseline 3.0 for compatibility. If your content is intended solely for iPad, Apple TV, iPhone 4 and later, and Mac OS X computers, you should use Main Level 3.1.
H.264 基线级别 3.0、基线级别 3.1、主要级别 3.1 和高级配置级别 4.1。
iPad、iPhone 3G 和 iPod touch(第 2 代及更高版本)支持 H.264 Baseline 3.1。但是,如果您的应用程序在较旧版本的 iPhone 或 iPod touch 上运行,则应使用 H.264 Baseline 3.0 以实现兼容性。如果您的内容仅适用于 iPad、Apple TV、iPhone 4 和更新版本以及 Mac OS X 计算机,则您应该使用 Main Level 3.1。
Baseline profile should be played everywhere.
应该在任何地方播放基线配置文件。
See the list here - http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles
请参阅此处的列表 - http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles
So if you have control over encoding (if the video is recorded from your iOS application), then you can do it programmatically. I just googled and found a piece of code where the profile is set: http://forums.macrumors.com/archive/index.php/t-1512924.html
因此,如果您可以控制编码(如果视频是从您的 iOS 应用程序录制的),那么您可以以编程方式进行。我只是用谷歌搜索并找到了一段设置配置文件的代码:http: //forums.macrumors.com/archive/index.php/t-1512924.html