无法播放某些视频 [英] Cannot play certain videos

查看:174
本文介绍了无法播放某些视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过我们的服务器在Android设备上播放电影.它不是媒体服务器,而是常规的Apache服务器.我们使用相同的API来访问iPhone上的视频,并且效果很好.

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.

在Android设备上,某些视频有效,而其他视频则无效.它们都是以相同的方式创建的,除了大多数无效的是由静止图像和音频组成.

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.

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

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.

编辑-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

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.

推荐答案

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

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

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

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

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

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

进行一些挖掘之后,我发现这正是问题所在.从某些Android手机(我相信2.3版之前)录制的视频将moov原子放置在文件的末尾.这使得它们不可流式传输.进行一些谷歌搜索将显示这是MP4文件和Flash播放器的常见问题,因为它们是用于流式传输视频的.

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.

MediaPlayer中甚至对此有特定的错误代码(但我没有看到记录的错误代码) MediaPlayer#MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK.

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.

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

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

希望对别人有帮助!

这篇关于无法播放某些视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆