1  +(UIImage *)getImage:(NSString *)videoURL
 2 
 3 {
 4 
 5     AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:[NSURL fileURLWithPath:videoURL] options:nil];
 6 
 7     AVAssetImageGenerator *gen = [[AVAssetImageGenerator alloc] initWithAsset:asset];
 8 
 9     gen.appliesPreferredTrackTransform = YES;
10 
11     CMTime time = CMTimeMakeWithSeconds(0.0, 600);
12 
13     NSError *error = nil;
14 
15     CMTime actualTime;    
16 
17     CGImageRef image = [gen copyCGImageAtTime:time actualTime:&actualTime error:&error];
18 
19     UIImage *thumb = [[UIImage alloc] initWithCGImage:image];
20 
21     CGImageRelease(image);
22 
23     return thumb;
24 
25  
26 
27 }

 

相关文章:

  • 2021-06-18
  • 2022-12-23
  • 2021-12-03
  • 2021-10-30
  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2021-06-27
猜你喜欢
  • 2021-06-15
  • 2021-10-11
  • 2022-01-14
  • 2021-06-24
  • 2022-12-23
  • 2021-10-10
相关资源
相似解决方案