- Notifications
You must be signed in to change notification settings - Fork6
Multiple videos merge in one video with manage scale & aspect ratio and also merge 4 videos to grid layou for Objective C.
License
NotificationsYou must be signed in to change notification settings
Datt1994/DPVideoMerger
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
For Swift and new features :-DPVideoMerger-Swift
CocoaPods is a dependency manager for Objective-C. You can install it with the following command:
$ gem install cocoapods
To integrate DPVideoMerger into your Xcode project using CocoaPods, specify it in yourPodfile
:
source'https://github.com/CocoaPods/Specs.git'platform:ios,'8.0'target'TargetName'dopod'DPVideoMerger'end
Then, run the following command:
$ pod install
Download Project and copy-pasteDPVideoMerger.h
&DPVideoMerger.m
files into your project
#import"DPVideoMerger.h" #import<AVKit/AVKit.h> #import<AVFoundation/AVFoundation.h>NSString *filePath = [[NSBundlemainBundle]pathForResource:@"1"ofType:@"mp4"];NSURL *fileURL = [NSURLfileURLWithPath:filePath];NSString *filePath1 = [[NSBundlemainBundle]pathForResource:@"2"ofType:@"mp4"];NSURL *fileURL1 = [NSURLfileURLWithPath:filePath1];NSString *filePath2 = [[NSBundlemainBundle]pathForResource:@"3"ofType:@"MOV"];NSURL *fileURL2 = [NSURLfileURLWithPath:filePath2];NSString *filePath3 = [[NSBundlemainBundle]pathForResource:@"4"ofType:@"mp4"];NSURL *fileURL3 = [NSURLfileURLWithPath:filePath3];NSArray *fileURLs = @[fileURL, fileURL1,fileURL2,fileURL3]; [DPVideoMergermergeVideosWithFileURLs:fileURLscompletion:^(NSURL *mergedVideoFile,NSError *error) {if (error) {NSString *errorMessage = [NSStringstringWithFormat:@"Could not merge videos:%@", [errorlocalizedDescription]]; UIAlertController *alert = [UIAlertControlleralertControllerWithTitle:@"Error"message:errorMessagepreferredStyle:UIAlertControllerStyleAlert]; [selfpresentViewController:alertanimated:YEScompletion:nil];return; } AVPlayerViewController *objAVPlayerVC = [[AVPlayerViewControlleralloc]init]; objAVPlayerVC.player = [AVPlayerplayerWithURL:mergedVideoFile]; [selfpresentViewController:objAVPlayerVCanimated:YEScompletion:^{ [objAVPlayerVC.playerplay]; }]; }]; [DPVideoMergergridMergeVideosWithFileURLs:fileURLsandVideoResolution:CGSizeMake(2000,2000)andRepeatVideo:truecompletion:^(NSURL *mergedVideoURL,NSError *error) {if (error) {NSString *errorMessage = [NSStringstringWithFormat:@"Could not merge videos:%@", [errorlocalizedDescription]]; UIAlertController *alert = [UIAlertControlleralertControllerWithTitle:@"Error"message:errorMessagepreferredStyle:UIAlertControllerStyleAlert]; [alertaddAction:[UIAlertActionactionWithTitle:@"OK"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction * _Nonnull action) {}]]; [selfpresentViewController:alertanimated:YEScompletion:nil];return; } AVPlayerViewController *objAVPlayerVC = [[AVPlayerViewControlleralloc]init]; objAVPlayerVC.player = [AVPlayerplayerWithURL:mergedVideoURL]; [selfpresentViewController:objAVPlayerVCanimated:YEScompletion:^{ [objAVPlayerVC.playerplay]; }]; }];
About
Multiple videos merge in one video with manage scale & aspect ratio and also merge 4 videos to grid layou for Objective C.
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published