- Home /
Question about looping mp4s
I am creating an animated children's book. I am making mp4s that loop in order to have richly animated backgrounds. If I have a 30 second mp4 is it possible to have the mp4 play out to 20 seconds and then loop from 10 seconds to 20 seconds? This is in order to have an intro to the animation and then be able to loop. Once the user hits next the animation would play out to 30 seconds in order to have an outro. Possible?
Another solution would be to just have three 10 seconds mp4s and once the first one is over it loops the middle one. I'm just worried that you might be able to see a break between the two mp4s.
Answer by TheSOULDev · Sep 14, 2017 at 08:53 PM
I'm assuming you're using a movie texture? In that case you should separate your intro into one file, and once it finished play the looping animation of the other one. In the Unity documentation there is sadly no funciton that manipulates the current time of the movie, so you can't just define a starting and ending time for a loop and make it loop like that. If you want greater control, perhaps you should convert your movie into an animation - animations have frames and you have much greater control with them than with movie textures.
Answer by iclyde1179 · Sep 14, 2017 at 09:06 PM
When converting it to an animation does that create individual images? And in that case wouldn't that be hundreds if not thousands of images for a 30fps mp4? Sorry newbie here. I also thought that maybe I could use the video player instead of using the mp4 as a texture.
Yes. 30 frames * 30 seconds is 900 frames. However, with that, you can directly control the animation play from specific frames. Without it, you'll have to cut your video and hope loading it won't cause a lag spike (it shouldn't, but still). Thats why, when making some moving behaviour we don't use pure animations, but a mix of animations, position transformations etc. If you're asking if it'll be performance intensive, I'd say not. Shouldn't be hard to manage too. If the video you have is high quality, you can't turn it into a bunch of sprite sheets, so you should use the video editing approach.