Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the start and end duration of "Selected frames" from Video using didFinishPickingMediaWithInfo?

I am doing slow motion in audio and video using AVFoundation(for Video) and Dirac(Audio). As part of it, i will show the video as frames in which the user will select the frames to do slow motion. Eg: 5-6 min of 10 min video.

I have to show the users two kinds of videos 1. through the video recorder from my application itself. 2. from the gallery.

Case1: No problem Now,i can record the videos though my video recorder and show the videos as frames to the user to select. Once the user selects some frames(Eg: 5 to 6 min of 10 min recorded video), using the below code, i am able to find the start/end duration of the selected frames or video.

NSNumber *start = [info objectForKey:@"_UIImagePickerControllerVideoEditingStart"];
NSNumber *end = [info objectForKey:@"_UIImagePickerControllerVideoEditingEnd"];

int startMilliseconds = ([start doubleValue] * 1000);
int endMilliseconds = ([end doubleValue] * 1000);

Case2: In this case, i am able to pick the video from the gallery and show them to the user in the form of frames to select. However, when i try to find the start/end duration of the video as i did in case 1 with the same code, its not working. I am always getting "0" for start/end duration.

like image 521
2vision2 Avatar asked Jul 17 '13 10:07

2vision2


1 Answers

Have a look at the new additions in AVFoundation in iOS 7 as it now natively supports slow motion video and audio auto-time stretching. This might change your approach, and a better solution.

like image 147
Ronan Avatar answered Nov 15 '22 09:11

Ronan