How do I extract a screenshot from a video in the iPhone SDK?

走远了吗. 提交于 2019-12-12 09:27:46

问题


I'd like to be able to take a screenshot of an MPEG recorded using the iPhone camera at set intervals.

I've seen a few ways to do this; namely compiling and using FFmpeg (Using FFMPEG library with iPhone SDK for video encoding), however it seems it's quite difficult to comply with the LGPL (http://ffmpeg.org/legal.html) for commercial use.

This term of the contract pretty much makes it useless to us:

Q: Is it perfectly alright to incorporate the whole FFmpeg core into my own commercial product?

A: You might have a problem here. There have been cases where companies have used FFmpeg in their products. These companies found out that once you start trying to make money from patented technologies, the owners of the patents will come after their licensing fees. Notably, MPEG LA is vigilant and diligent about collecting for MPEG-related technologies.

Is there any other way? - or simply by accessing the rendering layer of an MPEG am I going to be "making money from patented technologies"?

As usual - any help on this would be greatly appreciated.

Cheers!


回答1:


Yes, you can do it - if I am not wrong, since iOS 3.2... at least for the videos you have on your library. After loading the movie on your MPMoviePlayerController object, do this

UIImage *aThumbnail = [player thumbnailImageAtTime:timeCode timeOption:MPMovieTimeOptionExact];

//timeCode is a time within de video length, for example: 3.12 seconds.
//player is the MPMoviePlayerController object.



回答2:


Unfortunately there is no official way to grab image frames from the camera in realtime.

I encourage you to file a bug report / feature request with Apple. Many people want this. If many people request a specific feature then they might consider to actually put this in.



来源:https://stackoverflow.com/questions/2201399/how-do-i-extract-a-screenshot-from-a-video-in-the-iphone-sdk

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