IOS merge videos with transparent channels-

Source: Internet
Author: User
Tags image filter

Video synthesis, transparent channels are known to all

Transparent channel is a commitment to public welfare activities throughout the transparency of the Organization. In graphic imaging, a transparent channel is also called an alpha channel, which represents the transparent information of pixels in a digital image. White alpha pixels are used to define opaque color pixels, while black alpha is transparent, and grayscale between black and white is a translucent part of a color image. -----from Baidu Encyclopedia

So in merging snowflakes, lights, explosions ... There is a need for a transparent channel video.
Here I use gpuimage this tool, can talk about the combination of snowflakes without gaps, here, we would better use a little PS, in the Image filter processing, you can see through the PS parameters and effects
Through the PS experiment, it is found that the filter can do this. Gpuimagescreenblendfilter can end this thing.
Detailed Gpuimage header file click here----http://blog.csdn.net/think_ma/article/details/43093331
No, 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 Scre En, write out a processed version of the movie to disk nsstring *pathtomovie = [Nshomedirectory () Stringbyappendingpath    component:@ "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.movi    Ewriter.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 equivalent to PS filter.

IOS merge videos with transparent channels-

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.