[英]Save a section of video from UIImagePickerController programmatically
I'm trying to work out how to programmatically edit the video data I get back from UIImagePickerController. 我正在尝试找出如何以编程方式编辑从UIImagePickerController获取的视频数据。
During the recording of this video I'm going to be listening out for interesting events and logging their time, then when the video is finished, I want to be able to cut out 10 second clips at these times and save them as individual videos. 在录制此视频的过程中,我将倾听有趣的事件并记录他们的时间,然后在视频结束时,我希望能够在这些时间切出10秒钟的剪辑并将其保存为单独的视频。
You can do this with the editing controls, so I assume it is possible programmatically too. 您可以使用编辑控件来执行此操作,因此我认为也可以通过编程实现。
So far I just have the code below getting the video data and I'm not sure how to proceed. 到目前为止,我只有下面的代码来获取视频数据,但不确定如何继续。
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSString *type = [info objectForKey:UIImagePickerControllerMediaType];
[self dismissModalViewControllerAnimated:NO];
if ([type isEqualToString:(NSString *)kUTTypeVideo] ||
[type isEqualToString:(NSString *)kUTTypeMovie]) { // movie != video
NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
NSData *videoData = [NSData dataWithContentsOfURL:videoURL];
}
Any ideas? 有任何想法吗?
You can use FFMPEG library cut video into pieces. 您可以使用FFMPEG库将视频切成碎片。
Perfectly for your requirement. 非常适合您的要求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.