久久久精品一区ed2k-女人被男人叉到高潮的视频-中文字幕乱码一区久久麻豆樱花-俄罗斯熟妇真实视频

ios開發(fā)視頻合成,ios開發(fā)視頻合成的軟件

iOS 把兩個(gè)視屏合并成一個(gè)視頻詳細(xì)

- (void)viewDidLoad

京山網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,京山網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為京山上千多家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)營(yíng)銷網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的京山做網(wǎng)站的公司定做!

{ ? ? ? [superviewDidLoad];

? self.array 里面放的是兩個(gè)視頻的地址 ?,類型為NSurl

path 是你合并后的存放的地址路徑

? ? [self mergeAndExportVideos:self.array withOutPath:path];

}

- (void)mergeAndExportVideos:(NSMutableArray*)videosPathArraywithOutPath:(NSString*)outpath

{

? AVMutableComposition*mixComposition ?=[[AVMutableComposition alloc]init];

//音頻軌道

AVMutableCompositionTrack*audioTrack = [mixCompositionaddMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];

//視頻軌道

AVMutableCompositionTrack*videoTrack = [mixCompositionaddMutableTrackWithMediaType:AVMediaTypeVideo

preferredTrackID:kCMPersistentTrackID_Invalid];

CMTime totalDuration =kCMTimeZero;

for(inti =0; i videosPathArray.count; i++) {

//AVURLAsset:AVAsset的子類,此類主要用于獲取多媒體的信息,包括視頻、音頻的類型、時(shí)長(zhǎng)、每秒幀數(shù),其實(shí)還可以用來(lái)獲取視頻的指定位置的縮略圖。

AVURLAsset*asset = [AVURLAssetassetWithURL:videosPathArray[i]];

NSError*erroraudio =nil;

//獲取AVAsset中的音頻

AVAssetTrack*assetAudioTrack = [[assettracksWithMediaType:AVMediaTypeAudio]firstObject];

//向通道內(nèi)加入音頻

BOOLba = [audioTrackinsertTimeRange:CMTimeRangeMake(kCMTimeZero, asset.duration)

ofTrack:assetAudioTrack

atTime:totalDuration

error:erroraudio];

NSLog(@"erroraudio:%@%d",erroraudio,ba);

NSError*errorVideo =nil;

//獲取AVAsset中的視頻

AVAssetTrack*assetVideoTrack = [[assettracksWithMediaType:AVMediaTypeVideo]firstObject];

//向通道內(nèi)加入視頻

BOOLbl = [videoTrackinsertTimeRange:CMTimeRangeMake(kCMTimeZero, asset.duration)

ofTrack:assetVideoTrack

atTime:totalDuration

error:errorVideo];

NSLog(@"errorVideo:%@%d",errorVideo,bl);

totalDuration =CMTimeAdd(totalDuration, asset.duration);

}

//創(chuàng)建合成后寫入的路勁

NSURL*mergeFileURL = [NSURLfileURLWithPath:outpath];

if([[NSFileManagerdefaultManager]fileExistsAtPath:outpath])

{

NSLog(@"有文件");

return;

}

//這里開始導(dǎo)出合成后的視頻

AVAssetExportSession*exporter = [[AVAssetExportSessionalloc]initWithAsset:mixComposition

presetName:AVAssetExportPreset640x480];

exporter.outputURL= mergeFileURL;

NSLog(@"%@",exporter.supportedFileTypes);

if([self.typeisEqualToString:@"mp4"]) {

exporter.outputFileType=AVFileTypeMPEG4;

}else

{

exporter.outputFileType=AVFileTypeQuickTimeMovie;

}

exporter.shouldOptimizeForNetworkUse=YES;

[exporter exportAsynchronouslyWithCompletionHandler:^{

//導(dǎo)出的狀態(tài)

switch(exporter.status) {

caseAVAssetExportSessionStatusUnknown:

NSLog(@"exporter Unknow");

break;

caseAVAssetExportSessionStatusCancelled:

NSLog(@"exporter Canceled");

break;

caseAVAssetExportSessionStatusFailed:

//導(dǎo)出失敗

NSLog(@"exporter Failed");

break;

caseAVAssetExportSessionStatusWaiting:

NSLog(@"exporter Waiting");

break;

caseAVAssetExportSessionStatusExporting:

NSLog(@"exporter Exporting");

break;

caseAVAssetExportSessionStatusCompleted:

//導(dǎo)出成功

NSLog(@"exporter Completed");

dispatch_async(dispatch_get_main_queue(), ^{

//這里是回到你的主線程做一些事情

});

break;

}

}];

}

}

}

- (void)clearCache

{

if([[NSFileManagerdefaultManager]fileExistsAtPath:self.outPath])

{

//這里是你可以刪除你合成后的視頻文件

//self.outPath 是你保存視頻的路勁,當(dāng)然你也可以通過該路勁刪除它

NSLog(@"刪除成功");

[[NSFileManager defaultManager] removeItemAtPath:self.outPath error:nil];

}

}

iOS 本地多個(gè)短視頻合成

自己遇到的坑:

1.視頻和音頻需要分開合成;

2.豎屏拍攝的視頻,合成后改變了方向, 只好自己更改方向

實(shí)現(xiàn)步驟:

在.h中添加合成時(shí)需要調(diào)用的方法

在.m中添加

蘋果手機(jī)如何將兩個(gè)視頻合成一個(gè)視頻

我們可能有時(shí)會(huì)把視頻分成幾個(gè)片斷拍攝,完成以后需要把它們合并成一個(gè),那么,怎么把兩個(gè)或多個(gè)視頻合成一個(gè)視頻呢?

開啟分步閱讀模式

操作方法

01

進(jìn)入手機(jī)中的“附加程序”,找到"iMovie剪輯",打開它。

02

選擇“創(chuàng)建項(xiàng)目”,可選擇“影片”或“預(yù)先片”。

03

選擇“創(chuàng)建影片”。

04

點(diǎn)擊加號(hào)“+”。

05

進(jìn)入視頻,點(diǎn)擊要選擇的視頻,然后點(diǎn)擊一個(gè)圓圈內(nèi)有加號(hào)的圖標(biāo)。

06

繼續(xù)點(diǎn)擊“+”,重復(fù)以上步驟, 添加兩個(gè)或多個(gè)視頻,右下角有個(gè)設(shè)置的小圖標(biāo),點(diǎn)擊它。

07

可以在這里添加濾鏡、主題和音樂等,完了以后點(diǎn)擊“完成”。

08

這樣,兩個(gè)或多個(gè)視頻就被合并在一起了,我們點(diǎn)擊底部中間的保存分享小圖標(biāo)。

09

點(diǎn)擊“存儲(chǔ)視頻”,就可以到相冊(cè)里播放視頻了。

特別提示

可以重新進(jìn)入iMovie剪輯觀看視頻。

如有幫助,不勝榮幸。

本文名稱:ios開發(fā)視頻合成,ios開發(fā)視頻合成的軟件
瀏覽路徑:http://sd-ha.com/article10/hoocdo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供建站公司品牌網(wǎng)站建設(shè)、品牌網(wǎng)站設(shè)計(jì)、外貿(mào)網(wǎng)站建設(shè)、網(wǎng)站導(dǎo)航網(wǎng)站設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)