无法播放某些视频

发布于 2024-10-12 19:06:19 字数 1181 浏览 3 评论 0原文

我正在尝试通过我们的服务器在 Android 设备上播放电影。它不是一个媒体服务器,只是一个普通的 Apache 服务器。我们使用相同的 API 来访问 iPhone 上的视频,效果很好。

在 Android 设备上,某些视频可以播放,而另一些则不能。它们都是以相同的方式创建的,除了大多数不起作用的都是由静态图像和音频组成的。

我们尝试使用 Videora 重新编码它们,并尝试使用 MP4Box 提示它们。当存储在 SD 卡上时,所有视频都可以正常播放。我们也尝试过先将视频从服务器下载到SD卡上,保存为文件,然后从文件中播放,但这也不起作用。

帮助会很棒。我很困惑。 谢谢。

编辑 - Logcat:

01-19 08:19:12.669: DEBUG/MediaPlayer(1878): Couldn't open file on client side, trying server side

01-19 08:19:14.119: INFO/ActivityManager(1172): Displayed activity com.myproject/.VideoClass: 1966 ms (total 1966 ms)

01-19 08:19:15.779: ERROR/PlayerDriver(1071): Command PLAYER_INIT completed with an error or info UNKNOWN PVMFStatus

01-19 08:19:15.789: ERROR/MediaPlayer(1878): error (200, -32)

01-19 08:19:15.789: ERROR/MediaPlayer(1878): Error (200,-32)

01-19 08:19:15.789: DEBUG/VideoView(1878): Error: 200,-32

01-19 08:19:15.849: WARN/PlayerDriver(1071): PVMFInfoErrorHandlingComplete

更新: 这是三个不同视频的视频分析的粘贴箱。 第一个流从服务器在应用程序上传输。 第二个视频不会流式传输,但可以从设备下载然后播放。 第三个既不能流式传输也不能下载播放。 http://pastebin.com/9qChSkFz

WTF。

I'm trying to play movies on the Android device from our server. It is not a media server, just a regular Apache server. We use the same API to access the videos on the iPhone and it works fine.

On the Android device, certain videos work, and others do not. They were all created the same way, except the majority of the ones that don't work are composed of still images and audio.

We have tried re-encoding them with Videora, and tried hinting them with MP4Box. All of the videos play perfectly fine when stored on the SD card. We have also tried first downloading the video from the server to the SD card, saving it as a file, and then playing it from the file, but this does not work either.

Help would be amazing. I am massively confused.
Thanks.

Edit - Logcat:

01-19 08:19:12.669: DEBUG/MediaPlayer(1878): Couldn't open file on client side, trying server side

01-19 08:19:14.119: INFO/ActivityManager(1172): Displayed activity com.myproject/.VideoClass: 1966 ms (total 1966 ms)

01-19 08:19:15.779: ERROR/PlayerDriver(1071): Command PLAYER_INIT completed with an error or info UNKNOWN PVMFStatus

01-19 08:19:15.789: ERROR/MediaPlayer(1878): error (200, -32)

01-19 08:19:15.789: ERROR/MediaPlayer(1878): Error (200,-32)

01-19 08:19:15.789: DEBUG/VideoView(1878): Error: 200,-32

01-19 08:19:15.849: WARN/PlayerDriver(1071): PVMFInfoErrorHandlingComplete

UPDATE:
Here a pastebin of the video analysis for three different videos.
The first streams on the app from the server.
The second video will not stream, but can be downloaded then played from the device.
The third can neither be streamed or downloaded to be played.
http://pastebin.com/9qChSkFz

WTF.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哑剧 2024-10-19 19:06:19

我遇到了同样的问题,最初放弃后,我找到了解决方案。

我偶然发现了以下页面
http://developer.android.com/guide/appendix/media-formats.html 其中状态:

对于 3GPP 和 MPEG-4 容器,moov 原子必须位于任何 mdat 原子之前,但必须位于 ftyp 原子之后。

经过一番挖掘后,我发现这正是问题所在。从某些 Android 手机(我相信是 2.3 之前)录制的视频将 moov 原子放在文件末尾。这使得它们无法流式传输。一些谷歌搜索会告诉你这是 MP4 文件和 Flash 播放器的常见问题,特别是,因为它们是为了流视频而设计的。

MediaPlayer 中甚至有一个特定的错误代码(但我没有看到这些记录)
媒体播放器#MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK。

我的解决方案是通过外部工具运行视频文件,将 moov 原子移动到开头。我最终使用了 MP4Box: http://gpac.wp.institut-telecom.fr/mp4box/ 和命令

MP4Box -inter 500 original.mp4 -out fixed.mp4

希望对其他人有帮助!

I've run into the same problem, and after initially giving up, I've found a solution.

I stumbled upon the following page
http://developer.android.com/guide/appendix/media-formats.html which states:

For 3GPP and MPEG-4 containers, the moov atom must precede any mdat atoms, but must succeed the ftyp atom.

After doing some digging, I found out this is exactly the problem. Video recorded from certain Android phones (I believe pre 2.3) places the moov atom at the end of the file. This makes them un-streamable. Some googling will show you this is a common problem with MP4 files and flash players in particular, since they were made to stream video.

There is even a specific error code for this in MediaPlayer (but I did not see these logged)
MediaPlayer#MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK.

My solution is to run the video file through an external tool to move the moov atom to the start. I ended up using MP4Box: http://gpac.wp.institut-telecom.fr/mp4box/ and the command

MP4Box -inter 500 original.mp4 -out fixed.mp4

Hope that helps someone else!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文