Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrupt movie on iPhone 5s #63

Open
kusmi opened this issue Oct 30, 2013 · 2 comments
Open

Corrupt movie on iPhone 5s #63

kusmi opened this issue Oct 30, 2013 · 2 comments

Comments

@kusmi
Copy link

kusmi commented Oct 30, 2013

The resulting movies do not seem playable (corrupt) when recording on iPhone 5s - it worked for iPhone 5.

It's a pity the project "closed" - it was such a great tool to produce product-tour videos. Because of special requirements, we linked the files directly into a dedicated beta-version of our app just to produce nice looking videos.

@coolstar
Copy link
Owner

This is most likely an issue with iOS 7 as when you try recording the video outside the app it records a black screen. However, if both devices are staying in the app, it seems like it's a problem actually with the iPhone 5s changing something. It's a pity I can't provide up-to-date source anymore to fix it and can't fix it myself as I can't afford a 5s :(

@kusmi
Copy link
Author

kusmi commented Oct 30, 2013

In my setup I don't leave the app - as I added the screen-recording classes to my project. I'm not sure if this is a IOSurface issue - because if I add the following debug code to the project:

dispatch_async(_videoQueue, ^{
            while(_videoWriterInput != nil && !_videoWriterInput.readyForMoreMediaData)
                usleep(1000);
// debug                
if (debug % 30 == 0) {
    CIImage* ciImage = [CIImage imageWithCVPixelBuffer:pixelBuffer];
    CIContext* temporaryContext = [CIContext contextWithOptions:nil];
    CGImageRef videoImage = [temporaryContext
                             createCGImage:ciImage
                             fromRect:CGRectMake(0, 0,
                                                 CVPixelBufferGetWidth(pixelBuffer),
                                                 CVPixelBufferGetHeight(pixelBuffer))];
    UIImage* uiimage = [UIImage imageWithCGImage:videoImage];
    NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString* documentsDirectory = [paths objectAtIndex:0];
    NSString* jpgPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"Debug%d.jpg", debug]];
    BOOL result = [UIImageJPEGRepresentation(uiimage, 1.0) writeToFile:jpgPath atomically:NO];
    NSLog(@"Write Debug JPG: %@ -> %@",jpgPath, result ? @"Success" : @"Error");
}
debug++;

if (_videoWriterInput != nil)
    [_pixelBufferAdaptor appendPixelBuffer: pixelBuffer withPresentationTime: frameTime];

CVPixelBufferRelease(pixelBuffer);      // release back into pool
});

The jpgs are written correctly - it's just the movie file, which seems not playable anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants