Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Get thumbnail image from a recorded video in iOS

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 798
    Comment on it

    If you want to get thumbnail image from the recorded video in iOS then you can cut a small frame from that video to generate an image. You just need to send video output URL to below method as a parameter. This method willl return you NSData. Later you can convert that NSData to an UIImage.

    -(NSData*)assetGenerator:(NSURL*)partOneUrl{
    
    AVURLAsset *asset1 = [[AVURLAsset alloc] initWithURL:partOneUrl options:nil];
    AVAssetImageGenerator *generate1 = [[AVAssetImageGenerator alloc] initWithAsset:asset1];
    generate1.appliesPreferredTrackTransform = YES;
    NSError *err = NULL;
    CMTime time = CMTimeMake(1, 2);
    CGImageRef oneRef = [generate1 copyCGImageAtTime:time actualTime:NULL error:&err];
    UIImage *one = [[UIImage alloc] initWithCGImage:oneRef];
    NSData *thumbData = UIImageJPEGRepresentation(one,0.2);
    
    return thumbData;
    }
    

    Happy Coding!!!

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: