meslater / msimagemovieencoder Goto Github PK
View Code? Open in Web Editor NEWEncode a movie using images (CGBitmapContext, CVPixelBuffer) on iOS 4.1 and above. Uses AVAssetWriter, AVAssetWriterInput and AVAssetWriterInputPixelBufferAdaptor.
Encode a movie using images (CGBitmapContext, CVPixelBuffer) on iOS 4.1 and above. Uses AVAssetWriter, AVAssetWriterInput and AVAssetWriterInputPixelBufferAdaptor.
I m having problems with -(BOOL)nextFrameInBGRCGBitmapContext:(CGContextRef *)contextRef method. I just dont manage to get it working so it would use array of images. Here is raw code
-(BOOL)nextFrameInBGRCGBitmapContext:(CGContextRef *)contextRef{
counter++;
if (counter == 100) {
return NO;
}
// UIImage *image=[UIImage imageNamed:@"imageTest.PNG"];// i just want to use this image for start
CGContextRef context = *contextRef;
//CGContextRef context = CGBitmapContextCreate(NULL, image.size.width, image.size.height, 8, 0, CGImageGetColorSpace(image.CGImage), kCGImageAlphaPremultipliedLast);
CGContextSetRGBFillColor(context, 0,0,1,1); //RED
CGContextFillRect(context, CGRectMake(0, 0, frameSize.width, frameSize.height));
CGContextSetRGBFillColor(context, 1,0,0,0.5); //BLUE with alpha of 0.5
CGContextFillEllipseInRect(context, CGRectMake(1*counter, 200, 1*counter, 1*counter));
return YES;
}
If jou could just fix this example i would appreciate it BIG time.
Did managed to include pictures like this, but colors are just wrong... any ideas?
CGContextDrawImage(context, CGRectMake(0, 0, frameSize.width, frameSize.height), (image.CGImage));
P.S: Your code is awsome otherwise...:D
This is super good work indeed. Helped me a lot. Specially with performance.
But I do not think below is a good thing.
-(BOOL)nextFrameInBGRCGBitmapContext:(CGContextRef*)contextRef;
Because it allows only to return true and false.
But if the frame is same (not updated with the next frame). Then it repeatedly add the same frame to the recording and when play looks like slow motion video.
do you have an example of how to take a CGImage and write it into a frame? Currently the color channels are all switched up
When I return NO first time, method gets called one more time :|
-(BOOL)nextFrameInBGRCGBitmapContext:(CGContextRef *)contextRef {
videoExportCounter++;
if (videoExportCounter >= self.arrayOfImages.count) {
return NO;
}else{
UIImage *img = [self.arrayOfImages objectAtIndex:videoExportCounter];
CGContextRef context = *contextRef;
CGContextDrawImage(context, CGRectMake(0, 0, self.movieWidth, self.movieHeight), img.CGImage);
return YES;
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.