lottie-ios icon indicating copy to clipboard operation
lottie-ios copied to clipboard

Add support for video Export usage

Open tawhidkuet04 opened this issue 5 years ago • 11 comments

I can export animation with video but the problem is animation speed is variable in different device while exporting .the animation is actually not rendered correctly depending on device etc.The animation timespace is not linked to the video timespace . Any suggestion for this issue ?

tawhidkuet04 avatar Aug 04 '19 09:08 tawhidkuet04

I got the same issue. The faster device the slower animation.

In my case animation looks perfect on iPhone 6 with animationView.respectAnimationFrameRate = true. Any other device (XR, iPad Pro, iPhone 7/8) records it much slower.

According this question (4 years ago, btw), I decide to hardcode constants for each device for now :(

damikdk avatar Aug 08 '19 11:08 damikdk

@damikdk Thanks for the reply . How to set the hardcore constants for each device , I mean what constants i need to add to match the video timing ? Btw i am using version 2.5.3

tawhidkuet04 avatar Aug 08 '19 12:08 tawhidkuet04

I am using version 2.5.3 and project is in objective C . Can't find this functions . which version are you using ?

tawhidkuet04 avatar Aug 18 '19 07:08 tawhidkuet04

@tawhidkuet04 I use last one and Swift, sorry. It doesn't matter, because even my awful code above can't save us. Because current export depends on both device AND animation.

It will be super useful if somebody point us to some CoreAnimation primitive that we can use for export with AVVideoCompositionCoreAnimationTool and AVAssetExportSession. Doesn't matter public or private, we can fork and get it.

This setup can export animation, but I got the same problems @spykr describe in #30

let animationView = AnimationView()
animationView.animation = Animation()
let animationLayer = animationView.layer

animationLayer.repeatCount = .greatestFiniteMagnitude
animationLayer.beginTime = AVCoreAnimationBeginTimeAtZero

animationLayer.frame = CGRect(x:0, y:0, width: 50, height: 50)
parentLayer.addSublayer(animationLayer)

animationView.play()

But animation renders in result video, albeit wrong. So there is some logic above native primitives. I just started digging, but help is super welcome.

UPD: Demo repo

damikdk avatar Sep 02 '19 15:09 damikdk

Adding to feature requests

buba447 avatar Nov 25 '19 16:11 buba447

Hello there. I ran into this problem. Has anyone solved it? Or can @buba447 tell a deadline for when it will be implemented?

MikhailZimin avatar Dec 28 '20 04:12 MikhailZimin

+1

olivierlesnicki avatar Apr 01 '21 19:04 olivierlesnicki

Ran into the same problem.

suxinde2009 avatar May 26 '21 16:05 suxinde2009

Please help us.

namdhis avatar Nov 19 '21 07:11 namdhis

Is this problem solved yet?

deven-youpi avatar Mar 22 '22 20:03 deven-youpi

Just curious, why are folks interested in exporting Lottie animations to video files?

calda avatar Jul 13 '22 17:07 calda

Thanks all for the suggestion. We don't plan on adding support for video exports at this time. This seems like something that could be made available as a separate library on top of this one.

calda avatar Nov 03 '22 17:11 calda