Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Timeline, recorder and video timing

Discussion in 'Timeline' started by ThunderMusic, Sep 24, 2018.

  1. ThunderMusic

    ThunderMusic

    Joined:
    Sep 19, 2013
    Posts:
    38
    Hello,
    I've searched the forums about this and I only found one thread where someone mentioned it in his comment, but nobody seems to have noticed it, so I'm trying to ask it in a new post, hoping someone will take note.

    I'm currently trying to play a video with Unity's built-in video player component. This video is modifying a texture on a plane sitting in front of the camera. The scene is quite simple, really.

    Now, if I use a recorder track in Timeline and render it using a target camera (Main Camera) in FHD (1080p), the video plays at the right speed. But, if I render it using 360 View (2048x4096, 2048px cubemap), the video plays at least 300% the speed if not more. It's probably worth noting that the video is the only thing going faster... I have animated cameras and animated characters and they seem to play at the right speed. I still have to try with particles.

    Has anybody else seen this before? Is it considered "normal behavior"? Has it been reported as a bug? If not, should I report it and where?

    Thanks a lot

    [Edit] I just updated to the latest "Unity Recorder" version and it's not even possible to save my file as an MP4 with the settings I wrote above. It's not technically supported, but it worked... Now, I receive a bunch of NullReferenceExceptions. How am I supposed to render to stereoscopic 360 degrees?[/Edit]
     
    Last edited: Sep 24, 2018
  2. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    44
    Hi,

    Thanks a lot for the feedback!

    The video player speed up when recording is a know issue but we don't have a fix for it right now unfortunately.

    Basically, the video player uses its own update. The recorder slow the game time to fake the target frame rate.
    If you record at low resolution you might not notice the difference. but for a big resolution (like the one you use for the 360View) the slow down is enough to cause the video player and the recorder to desynch.

    For instance, you want to record 4k@60fps, but your game or machine cannot run at this rate, the recorder will take the time necessary to do a 4k rendering (which might take several seconds) then advance to the next frame (i.e 1/60 sec). Meanwhile the video player thinks that the elapsed time is the real time that it took to render the 4k frame. thus the speed up.

    If you don't have audio in your video player, you can workaround the issue by adding a script that pauses the video player at the beginning, and manually step forward the video to the correct time on each update.

    Also, the error you're getting with the latest recorder is a bug and we'll work on fixing it.

    Hope this helps.
     
  3. ThunderMusic

    ThunderMusic

    Joined:
    Sep 19, 2013
    Posts:
    38
    Ok, nice to know. Thanks a lot for the extremely quick response.

    So, for the video,what is the best way to achieve what you are talking about? I don't start the video on awake and when I start it manually, I just go from frame to frame manually in "FixedUpdate" ou "Update"? My guess is DeltaTime will give me the real time delta and not the "frame time delta". Is there a property or method for doing that or should I have my own "counter"?

    For the exception while rendering to mp4 with a "bigger than supported" frame, do you have a time estimate for the bug fix? Can I help? I'm a senior programmer and I have been programming professionally for the last 20 years and as a hobbyist for the last 34 years. The thing is, this feature is crucial for one of my projects as I'm using the recorder to render a presentation video and the video is due in about 3 to 4 weeks max.

    Thanks a lot
     
  4. wellchichi

    wellchichi

    Joined:
    Jul 16, 2017
    Posts:
    1
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.Video;

    public class Video : MonoBehaviour {

    public GameObject myVideo;

    private VideoPlayer video;
    // Use this for initialization
    void Start () {
    video = myVideo.GetComponent<UnityEngine.Video.VideoPlayer>();
    }

    // Update is called once per frame
    void Update()
    {
    if (video.isActiveAndEnabled)
    {
    video.Pause();
    video.StepForward();
    }
    }
    }


    try this script…
     
  5. ThunderMusic

    ThunderMusic

    Joined:
    Sep 19, 2013
    Posts:
    38
    Excellent, Thanks. I'll be sure to try that. My initial specs finally changed, so I don't need it right now, but I will need it by the end of the year, so I'll let you know if it works correctly.