Latest 1.0.0
Homepage https://github.com/Datt1994/DPVideoMerger
License Apache 2.0
Platforms ios
Authors

DPVideoMerger

For Swift :- DPVideoMerger-Swift

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C. You can install it with the following command:

$ gem install cocoapods

Podfile

To integrate DPVideoMerger into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'TargetName' do
pod 'DPVideoMerger'
end

Then, run the following command:

$ pod install

Add Manually

Download Project and copy-paste DPVideoMerger.h & DPVideoMerger.m files into your project

Usage

    #import "DPVideoMerger.h"
    #import <AVKit/AVKit.h>
    #import <AVFoundation/AVFoundation.h>

    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"1" ofType:@"mp4"];
    NSURL *fileURL = [NSURL fileURLWithPath:filePath];
    NSString *filePath1 = [[NSBundle mainBundle] pathForResource:@"2" ofType:@"mp4"];
    NSURL *fileURL1 = [NSURL fileURLWithPath:filePath1];
    NSString *filePath2 = [[NSBundle mainBundle] pathForResource:@"3" ofType:@"MOV"];
    NSURL *fileURL2 = [NSURL fileURLWithPath:filePath2];
    NSString *filePath3 = [[NSBundle mainBundle] pathForResource:@"4" ofType:@"mp4"];
    NSURL *fileURL3 = [NSURL fileURLWithPath:filePath3];

    NSArray *fileURLs = @[fileURL, fileURL1,fileURL2,fileURL3];

    [DPVideoMerger mergeVideosWithFileURLs:fileURLs completion:^(NSURL *mergedVideoFile, NSError *error) {
        if (error) {
            NSString *errorMessage = [NSString stringWithFormat:@"Could not merge videos: %@", [error localizedDescription]];
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Error" message:errorMessage preferredStyle:UIAlertControllerStyleAlert];
            [self presentViewController:alert animated:YES completion:nil];
            return;
        }

        AVPlayerViewController *objAVPlayerVC = [[AVPlayerViewController alloc] init];
        objAVPlayerVC.player = [AVPlayer playerWithURL:mergedVideoFile];
        [self presentViewController:objAVPlayerVC animated:YES completion:^{
            [objAVPlayerVC.player play];
        }];
    }];

Latest podspec

{
    "name": "DPVideoMerger",
    "version": "1.0.0",
    "summary": "Multiple videos merge in one video with manage scale and aspect ratio for Objective C.",
    "homepage": "https://github.com/Datt1994/DPVideoMerger",
    "license": "Apache 2.0",
    "authors": {
        "Datt1994": "[email protected]"
    },
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/Datt1994/DPVideoMerger.git",
        "tag": "1.0.0",
        "commit": "a489f35fb7dc6d553e47f93261a9d3a31f148c63"
    },
    "public_header_files": "DPVideoMerger/DPVideoMerger/DPVideoMerger/DPVideoMerger.h",
    "source_files": "DPVideoMerger/DPVideoMerger/DPVideoMerger/DPVideoMerger.{h,m}"
}

Pin It on Pinterest

Share This