iOS video capture compress upload and play

Source: Internet
Author: User

Video sharing

Want to achieve a video on iphone, upload to the cloud to share to mobile friends.

Technology implementation

Video compression. The video of the iphone is very large, a few seconds on a few 10 trillion files, need to do compression, the original consideration with ffmpeg, installation is more complex, there are many tutorials on the web, but there are certain risks when passing AppStore audit.
The first thing to do is click on the code to start recording:

if([Uiimagepickercontroller Issourcetypeavailable:uiimagepickercontrollersourcetypecamera]) {UIImagePic Kercontroller*imagepicker =[[Uiimagepickercontroller alloc] init]; Imagepicker.videoquality= uiimagepickercontrollerqualitytypeiframe960x540;//Video quality settingsImagepicker.sourcetype=Uiimagepickercontrollersourcetypecamera; Imagepicker.Delegate=Self ; Imagepicker.allowsediting=YES; Imagepicker.videomaximumduration=300.0f;//set maximum recording 5 minutesImagepicker.mediatypes= [Nsarray arraywithobject:@"Public.movie"]; [Self presentviewcontroller:imagepicker animated:yes completion:^{                    }]; }

Callback method after recording:

- (void) Imagepickercontroller: (Uiimagepickercontroller *) Picker Didfinishpickingmediawithinfo: (NSDictionary *) info{Nsurl*url =[Info Objectforkey:uiimagepickercontrollermediaurl]; NSLog (@"------%@", URL); NSString*appdocumentpath =[Nssearchpathfordirectoriesindomains (NSDocumentDirectory, Nsuserdomainmask, YES) lastobject]; Nsurl*uploadurl = [Nsurl fileurlwithpath:[[appdocumentpath stringbyappendingpathcomponent:[self dateString]] Stringbyappendingstring:@". mp4"]]; //Compress Movie First[self convertvideotolowquailtywithinputurl:url outputurl:uploadurl]; [Self Dismissviewcontrolleranimated:yes completion:^{            }]; }

iOS video capture compress upload and play

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.