iPhone Video compression on/off - iphone

I have implemented video capturing by:
IImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
NSArray *sourceTypes = [UIImagePickerController availableMediaTypesForSourceType:imagePicker.sourceType];
if ([sourceTypes containsObject:(NSString *)kUTTypeMovie ]){
imagePicker.mediaTypes = sourceTypes;
}
imagePicker.delegate = self;
[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];
I can record video and send it to YouTube using YouTube API, but if the video length is more then about 5 minutes, and I click USE - the application is closed. But no problem appear if I select even 10 minutes video from library (i see "Compressing video" progress), video is saved to my view and uploaded to YouTube.
Can anybody tell me what the problem could be?

You used QualityTypeHigh with high resolution 1280x720. so it take so much memory.
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
[imagePicker setVideoQuality:UIImagePickerControllerQualityQualityTypeMedium];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
[imagePicker setVideoMaximumDuration:30];
imagePicker.allowsEditing = YES;
[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];

Related

UIImagePickerControllerSourceTypePhotoLibrary in iOS 7 is not Working

When I upgraded to iOS7, my app is showing an empty view controller when I access the photo Library from the application. It was working with older frameworks.
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePickerController.delegate = self;
self.imagePicker = imagePickerController;
//self.imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:self.imagePicker animated:YES completion:nil];
Please apply direct this code
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePickerController.delegate = self;
[self presentViewController:imagePickerController animated:YES completion:nil];
when this code run then "application" Would like to access your photos message come when you click on OK then all images will be displayed
Thanks.

Open camera view upon app Startup (iOS6)

what im trying to do is to have the app open up with the camera as the first screen. It isn't working and i don't know what im missing. If anyone can fill me in that would be wonderful... Thanks.
- (void)viewDidLoad
{
[super viewDidLoad];
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
}
else
{
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}
}
Try like that. Hope it helps you:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
[self presentViewController:imagePicker animated:YES completion:nil];

How to set Custom overlay view on Editing View of UIImagePickerController?

All
I have create UIImagePickerController with delegate and picking images from PhotoLibrary.
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
[self presentModalViewController:imagePicker animated:YES];
And when application reach to Editing view of UIImagePickerController i set one Overlay view and create two buttons for it.
Cancel and Choose
On Cancel Button click
[imagePicker popToViewController:[currentViewController.viewControllers objectAtIndex:1] animated:YES];
this cod work fine..
But choose Button does not working,
if i set code like here,
[self imagePickerController:imagePicker didFinishPickingMediaWithInfo:[imagePicker mediaTypes]];
than it returns NULL value of info dictionary.
Is that any other way to set overlay view on Editing ImagePicker ?
Regards,
try this code
CustomOverlayView *CustomOverlayView = [[CustomOverlayView alloc] initWithFrame:CGRectZero];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.allowsEditing = NO;
imagePickerController.delegate = self;
imagePickerController.showsCameraControls = YES;
[imagePickerController.view addSubview:CustomOverlayView];
[self presentModalViewController:imagePickerController animated:YES];
}

How to take video file from library in iphone

I am trying to do this .I know it very simple question .
Take Video: Take Picture: Choose from Library: Everything I find has separate buttons. Kinda like in the facebook app when you click on the camera button you get this picture.
I think people will me as soon as possible
Thanks in advance
To take Picture, video and select an image from photo library, UIImagePickerController will help you.
Ref: UIImagePickerController
To take picture and video, UIImagePickerControllerCameraCaptureMode has to be set properly.
Also the sourceType needs to be set as we required. See UIImagePickerControllerSourceType.
I guess these summary will help you. See the reference for more details.
If u want to browse thru ur photo library,
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:picker animated:YES];
[picker release];
If u want to take new photo,
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker. cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:picker animated:YES];
[picker release];
If u want to take new video,
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker. cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:picker animated:YES];
[picker release];
I can't believe this wasn't wrapped up in a little class. So I made one
https://github.com/fulldecent/FDTake
Example there shows taking a picture and choosing a photo from library.

How to store the time period(duration) of a captured video in iPhone?

Thanks to all for responding to the questions which I posted.
I got one problem that is, while capturing the video in the iPhone, I don't know how to store the time period (duration) that I captured video with iPhone. Can any one solve my problem.
I am using the following code for capturing.
-(void) RecordVideoWithCamera
{
printf("\n Hai I am in record vedio with camera -============");
[self startCameraPickerFromViewController:self usingDelegate:self];
}
- (BOOL)startCameraPickerFromViewController:(UIViewController*)controller usingDelegate:(id<UIImagePickerControllerDelegate>)delegateObject
{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
UIImagePickerController *picker = [[[UIImagePickerController alloc] init]autorelease];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
picker.delegate = self;
picker.showsCameraControls=YES;
picker.allowsEditing = NO;
UIView *overlayView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
picker.cameraOverlayView = overlayView;
[controller presentModalViewController:picker animated:YES];
}
return YES;
}
Thanking you,
Madan Mohan.
I think you should check CMTime struct.