iOS 合并帶有透明通道的視頻-

來源:互聯網
上載者:User

iOS 合并帶有透明通道的視頻-

 


所以在合并雪花,燈光,爆破。。。 這裡就需要有透明通道的視頻。
這裡我用的是GPUImage 這個工具,可以講雪花無縫隙的結合起來,說到這裡,大家最好會使用一點ps,在圖片濾鏡處理的時候,可以通過ps來看看參數和效果
通過ps實驗,發現濾色可以做到這一點。GPUImageScreenBlendFilter 可以結局這個事情。
詳細的GPUImage的標頭檔點擊這裡----http://blog.csdn.net/think_ma/article/details/43093331
不說了code _movieFile = [[GPUImageMovie alloc] initWithURL:url];
    _movieFile.runBenchmark = YES;    _movieFile.playAtActualSpeed = NO;    _movieFile2 = [[GPUImageMovie alloc] initWithURL:url2];    _movieFile2.runBenchmark = YES;    _movieFile2.playAtActualSpeed = NO;    _filter = [[GPUImageScreenBlendFilter alloc] init];    //    filter = [[GPUImageUnsharpMaskFilter alloc] init];    [_movieFile addTarget:self.filter];    [_movieFile2 addTarget:self.filter];    // Only rotate the video for display, leave orientation the same for recording    // In addition to displaying to the screen, write out a processed version of the movie to disk    NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@Documents/last.mov];    unlink([pathToMovie UTF8String]); // If a file already exists, AVAssetWriter won't let you record new frames, so delete the old movie        NSLog(@file = %@,pathToMovie);    NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];        self.movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(640.0, 360.0)];    [self.filter addTarget:self.movieWriter];    // Configure this for video from the movie file, where we want to preserve all video frames and audio samples    self.movieWriter.shouldPassthroughAudio = YES;    //movieFile.audioEncodingTarget = self.movieWriter;    [_movieFile enableSynchronizedEncodingUsingMovieWriter:self.movieWriter];        [self.movieWriter startRecording];    [_movieFile startProcessing];    [_movieFile2 startProcessing];    __block mlkiMovie * sself = self;        [self.movieWriter setCompletionBlock:^{        [sself.filter removeTarget:sself.movieWriter];        [sself.movieFile endProcessing];        [sself.movieFile2 endProcessing];        [sself.movieWriter finishRecording];        NSLog(@ok);    }];

GPUImageScreenBlendFilter 相當於ps的濾鏡。

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.