Iam trying to capture video using front camera in ios and convert that into sequence of images I am trying to use avassetimagegenerator for that . Iam new to AV Foundation please help me in this , thanks .
            Asked
            
        
        
            Active
            
        
            Viewed 676 times
        
    1 Answers
0
            First present an UIImagePickerController
- (void)presentVideoPicker {
    UIImagePickerController *anImagePicker = [[UIImagePickerController alloc] init];
    anImagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    anImagePicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
    anImagePicker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *)kUTTypeMovie, nil];
    anImagePicker.allowsEditing = YES;
    anImagePicker.delegate = self;
    UIPopoverController *aPopoverController = [[[UIPopoverController alloc] initWithContentViewController:anImagePicker] autorelease];
    [aPopoverController presentPopoverFromRect:self.view.frame inView:[[self view] window]
                          permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
Capture the Video in UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    NSString *aMediaType = [info objectForKey:UIImagePickerControllerMediaType];
    if ([aMediaType isEqualToString:(NSString *)kUTTypeMovie]) {
        NSURL *aVideoURL = [info objectForKey:UIImagePickerControllerMediaURL];
        [self readMovie:aVideoURL];
        // If you want the Duration fo the Video, Use this
        AVPlayerItem *aPlayerItem = [AVPlayerItem playerItemWithURL:aVideoURL];
        CMTime aDuration = aPlayerItem.duration;
        float anInSeconds = CMTimeGetSeconds(aDuration);
        NSInteger aDuration = nearbyintf(anInSeconds);
    }
}
Now code for the Method you called in the Delegate - (void) readMovie:(NSURL *)url
Refer this link: http://www.7twenty7.com/blog/2010/11/video-processing-with-av-foundation
...
Once you generate the CVImageBuffer for an Image,
to convert it to UIImage
- 
                    how to create CVImageBuffer ? – naveen May 16 '13 at 10:21
 - 
                    in method `- (void) readNextMovieFrame`, you get the CVImageBufferRef for each frame right... – Roshit May 16 '13 at 14:16