I'm writing a simple program using Objective C to run a QTMovie file, extract each video frame, and save it to file.
I have debugged and debugged and debugged and have one problem I can't seem to get around.
I currently have an NSImage that is returned from currentFrameImage and then tried to convert to .TIFF using TIFFRepresentation.
NSImage * fram = [film currentFrameImage];
NSData * fram1 = [fram TIFFRepresentation];
[fram1 writeToFile:name atomically:YES];
When this failed to work I looked around of many forums, google, etc. And changed my code to:
NSImage * fram = [film currentFrameImage];
//NSData * fram1 = [fram TIFFRepresentation];
NSArray * testArray = [fram representations];
NSImageRep * testType = [testArray lastObject];
NSData * fram1 = [NSBitmapImageRep representationUsingType:NSBMPFileType properties:nil];
[fram1 writeToFile:name atomically:YES];
But this still fails to work. Any thoughts are appreciated. Also if anyone knows of source code that does this frame extraction, so I can give up on my code I'd be happy with that.
Thanks!
I have debugged and debugged and debugged and have one problem I can't seem to get around.
I currently have an NSImage that is returned from currentFrameImage and then tried to convert to .TIFF using TIFFRepresentation.
NSImage * fram = [film currentFrameImage];
NSData * fram1 = [fram TIFFRepresentation];
[fram1 writeToFile:name atomically:YES];
When this failed to work I looked around of many forums, google, etc. And changed my code to:
NSImage * fram = [film currentFrameImage];
//NSData * fram1 = [fram TIFFRepresentation];
NSArray * testArray = [fram representations];
NSImageRep * testType = [testArray lastObject];
NSData * fram1 = [NSBitmapImageRep representationUsingType:NSBMPFileType properties:nil];
[fram1 writeToFile:name atomically:YES];
But this still fails to work. Any thoughts are appreciated. Also if anyone knows of source code that does this frame extraction, so I can give up on my code I'd be happy with that.
Thanks!