dimanche 24 juillet 2016

How to edit video with several effect

I want to edit a video and add several effects by AVFoundation,
for example:
0 ~ 1 second, flip frame
1 ~ 2 second, rotate
2 ~ 3 second, scale
3 ~ 4 second, slow forward video
4 ~ 5 second, reverse video
...

I used to try CAAnimation to make some effects:

CALayer *parentLayer = [CALayer layer];
CALayer *videoLayer = [CALayer layer];

// CAAnimation...
CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
......

[videoLayer addAnimation:scaleAnimation forKey:@"animationGroup"];

composition.animationTool = [AVVideoCompositionCoreAnimationTool
  videoCompositionCoreAnimationToolWithPostProcessingAsVideoLayer:videoLayer inLayer:parentLayer];

But animation effects change video frame gradually, and I don't want the duration.

Is there any other solutions?

Aucun commentaire:

Enregistrer un commentaire