This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// PhotoCaptureSample | |
// | |
// Created by Tadashi on 2017/09/23. | |
// Copyright © 2017 UBUNIFU Incorporated. All rights reserved. | |
// | |
import UIKit | |
import AVFoundation | |
import Photos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <AVFoundation/AVFoundation.h> | |
-(void)MixVideoWithText | |
{ | |
AVURLAsset* videoAsset = [[AVURLAsset alloc]initWithURL:url options:nil]; | |
AVMutableComposition* mixComposition = [AVMutableComposition composition]; | |
AVMutableCompositionTrack *compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid]; | |
AVAssetTrack *clipVideoTrack = [[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; | |
AVMutableCompositionTrack *compositionAudioTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid]; |