Search Unity

Animation and video synchronising

Discussion in 'Animation' started by JoannaTarko, Mar 31, 2017.

  1. JoannaTarko


    Mar 31, 2017
    I have a video clip and a camera animation in fbx, both with 25 fps. I need them perfectly in sync, so I switched off Resample Curves and Animation Compression in import settings, and additionally I cloned the animation so I could edit it in Animation window and I selected all the keyframes and set it to Broken, Both Tangents constant.
    I use the new Video Player for displaying the video. I saw that animation pipeline changed from version 5.5 to 5.6 and I got weird object movement when I imported fbx to Unity 5.6, and also Animation window kept freezing when I tried to edit keyframes, so I set up everything mentioned above in 5.5 version and opened it in 5.6 just to add Video Player.

    They were still not in sync, so I wrote a script to set animation time according to video time inside Update() function:
    Code (CSharp):
    1. if (cameraMovement.IsPlaying("cameraMovementFromFBX") && vPlayer.isPlaying) {
    2.             cameraMovement ["cameraMovementFromFBX"].time = (float)vPlayer.time;
    3.         }
    And even if the time seems in sync, visually they still don't look right, there is a slight jitter.

    I'm totally new to Unity, so I have no idea if what I'm trying to do is even possible, because of the various frame rate Unity uses. Any hint would be great.
    vasilcom likes this.