Merge videos with transparent channels in iOS-

Source: Internet
Author: User
Tags image filter

Merge videos with transparent channels in iOS-

 


So we are merging snow, lighting, and blasting... A video with a transparent channel is required.
Here I am using the GPUImage tool. We can talk about the seamless combination of snowflakes. Here, we 'd better use a bit of ps. when processing the image filter, you can use ps to check the parameters and effects.
Through the ps experiment, we found that the filter color can achieve this. GPUImageScreenBlendFilter can end this issue.
Detailed GPUImage header file click here ---- http://blog.csdn.net/think_ma/article/details/43093331
Not to mention 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 is equivalent to a ps filter.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.