Workaround playing a video .mov file in iOS app? Also related to Adobe Flash Animations

不羁的心 提交于 2021-02-07 18:22:09

问题


After researching lots on StackOverflow and Class References, iOS MPMoviePlayerController cannot play .mov video files. AVPlayer can play .mov files but there are no controls.

I want my app to play .mov files, because Adobe Flash Animation provides .mov as the cleanest and native looking video. If I convert the same video to mp4 (supported formats) there is loss in quality, even when I turn the video rate to 100 MB/s and highest quality video.

Quite ironic, QuickTime is Apple's intellectual property and its products do not support .mov video files.

How do I get around this issue?


回答1:


MPMoviePlayerController (and iOS in general) does support .mov files. See Apple's class documentation, section "Supported Formats". But only a limited number of video codecs are supported.

Deceptively, the Quicktime ".mov" format is not a video codec, but rather audio/video container format that can contain video and audio (and some other things) in any number of compression codecs (h.264, mpeg2, ProRes, MJPEG, AAC, mp3, etc.)

Your files don't work because they include video compressed with a codec which iOS does not support (maybe PhotoJPEG if they are Flash animations?). You can check the format of your videos by opening them in Quicktime Player on Mac OS X and clicking "Show Movie Inspector" in the Window menu.

It is not possible to add support for additional codecs to the native iOS video playback system (MPMoviePlayerController and friends). This leaves two options;

  • Recompress your files to make them compatible
  • Use a different video playback framework.

You say you have already tried recompressing the files, but this is still the best option. I encourage you to try recompressing the files with Handbrake. The h.264 codec is capable of excellent results (see BluRay movies, the iTunes Movie store, etc.)

If you really must play back your animations in their current format, you'll need to use another video playback framework. I suggest you look at libVLC and VLCKit from the excellent VideoLan project (I'm having problems accessing the VLCKit project pages, but a fork is available here). Be aware, non-native video playback will very likely not be hardware accelerated and so will eat your users' batteries.

One last thing, if your videos are short and silent… might animated GIF be an option?



来源:https://stackoverflow.com/questions/27753755/workaround-playing-a-video-mov-file-in-ios-app-also-related-to-adobe-flash-ani

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!