Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Video Unity Recorder movie output is too fast

Discussion in 'Audio & Video' started by hedgefield, Apr 19, 2019.

  1. hedgefield

    hedgefield

    Joined:
    Jan 1, 2014
    Posts:
    31
    Hey there,

    I'm using the Unity Recorder 2.0.0-preview6 package with Unity 2018.3.8f1 on Windows 10, and I'm having some trouble with the movie output speed. When I render an MP4, the resulting video footage is faster than it should be when played in the editor, while the audio track is at the correct speed. For example, I have one recorder clip set up to record 10 seconds of the timeline in 4k. The resulting video output is 8 seconds. What's even weirder, is that when I set the output to 1080p, the resulting video is 6 seconds.

    Here is my setup:
    - I have one timeline in my scene, set to 30 FPS.
    - The Playable Director is set to update on the DSP clock, because the timeline is animated to an audio track.
    - I use a mixture of activation tracks, animation tracks with clips, and animation tracks recorded inline.
    - I have a RecorderClip set up in the timeline to output a 1080p MP4. Settings are shown in the screenshot.

    cc @marief_unity
     

    Attached Files:

  2. pintianz

    pintianz

    Joined:
    Mar 1, 2015
    Posts:
    25
    Having the same problem. The recorded video is way too fast. The video was designed to be in sync with the background music, but the recorded version is out of sync with audio playing at normal speed.
    Unity 2018.3.14,
    Recorder ver. 2.0.1-preview.1
    Record format: mp4
    Constant playback, Film(24), cap
    @marief_unity
     
  3. ibanezguy2112

    ibanezguy2112

    Joined:
    Jun 21, 2018
    Posts:
    1
    still running into this problem as well
     
  4. Teejay5

    Teejay5

    Joined:
    Feb 26, 2010
    Posts:
    101
    I'd like to bump this issue, happens here too. It's even worse if you're using a video texture in the game, the video texture will play back at like 10x the speed it's supposed to.
     
  5. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    816
    Can someone from Unity get in here and help to figure this out? Please?

    I am trying to make some trailers and it is impossible to get the recorder to output at the correct speed.

    Regards,
    Carlos
     
  6. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    816
    I think I figured out a way to get the right speed in the output of the recorder! I set the sync in Quality Settings to every second v blank, I pressed the game window's top right button VSync to activate it, and set the Recorder target setting in the top right to NTSC(29.97), and finally I unchecked Capture audio in the recorder. After I set these and recorded the output was at the right speed. Of course I had to take the video to AE or other software to like it to add the audio back.

    I hope this helps someone.

    Regards,
    Carlos
     
    GeorgeAdamon likes this.
  7. SkareMedia

    SkareMedia

    Joined:
    Jan 8, 2019
    Posts:
    6
    Im having this same issue too. I tried your steps but cant figure out where/how to activate the game windows VSync "I pressed the game window's top right button VSync to activate it"

    Where is this buttoin exactly?
     
  8. Romaleks360

    Romaleks360

    Joined:
    Sep 9, 2017
    Posts:
    43
    Any updates? That's very annoying! Basically makes Unity Recorder totally useless
     
  9. Dirrogate

    Dirrogate

    Joined:
    Feb 18, 2014
    Posts:
    122
    here:
     

    Attached Files:

  10. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    816
    And here as well:
     

    Attached Files:

  11. SolutionStudios

    SolutionStudios

    Joined:
    Aug 1, 2014
    Posts:
    108
    This problem still occurs even when using the VSync setting above. To fix this you can manually control the frame of the video the VideoPlayer is displaying like this:
    Code (CSharp):
    1. void Update() {
    2.     videoPlayer.Pause();
    3.     if (videoPlayer.frame / videoPlayer.frameRate < Time.time) {
    4.         videoPlayer.StepForward();
    5.     }
    6. }
    This works if the framerate of the playing video is lower than the framerate you are trying to record at (if not then you could try replacing the if statement with a while loop). And it assumes you start playing the video when the scene starts. If not just subtract the time the video starts from Time.time above.
    You also might be tempted to do this by setting the frame number directly with `videoPlayer.frame = ...`. But don't do this as it just causes more problems. Using `StepForward` and `Pause` is your best option.
    @Teejay5
     
  12. Dirrogate

    Dirrogate

    Joined:
    Feb 18, 2014
    Posts:
    122
    So I had the same problem - a Video texture playing on a billboard (plane) in the engine, will not record with UnityRecorder.
    I've done all the error checking so far:
    - Set Vblank and even tried Vblank to every second frame, in game window and main settings/
    - Set fps to 30 in Unity Recorder
    - set timeline to 30 fps (the billboard video is on a plane gameobject and has a simple translation movement on x axis)
    - Video on billboard is also 30 fps and plays fine in Unity when NOT recording with UnityRecorder.

    - Even worse should you decide to play the video at slower speed using Unity Player slider and recording to 4k.


    Solution:
    Luckily I own the VR panorama asset from the asset store and it has a script called videoSync. Which is the same code as the post by @SolutionStudios

    Come on Unity, UnrealEngine is miles ahead in Video production and Unity is lagging in fixing solutions that make or break a feature.

    Has this previous problem with Unity Recorder not recording Camera iSO/aperture and depthof field been fixed?
    https://forum.unity.com/threads/rec...ecord-a-take-to-timeline.892168/#post-5905694

    @cguertin , any insights?
    Kind Regards
     
  13. Matjio

    Matjio

    Unity Technologies

    Joined:
    Dec 1, 2014
    Posts:
    32
    Hi everyone,

    Sorry to have missed this thread.

    Synchronization between audio and rendering with video recorder should be fixed at leat in the latest Recorder package (2.2). If you still have issues, please share it here (ideally with a small project to reproduce and a ticket submitted in the Editor so that you can track our progress).

    Note: With the Recorder Window, for video recording, you must select frame rate option to Constant and matching your main Timeline frame rate. With a Recorder clip on Timeline this is set automatically.

    @Dirrogate The VideoPlayer and the Unity Recorder are not generally compatible because the VideoPlayer does not support the use of Time.captureFramerate and this is how the recorder changes the execution speed to perform non-realtime rendering. Check this thread which lists workarounds or solutions depending on your usage: https://forum.unity.com/threads/frame-accurate-video-or-image-sequence-playback.854203/

    @Dirrogate Re. animation clip recording of Camera ISO and aperture, we have not yet a solution. But this is high on our priority list.

    Best,
    Mathieu
     
    Dirrogate likes this.
  14. Matjio

    Matjio

    Unity Technologies

    Joined:
    Dec 1, 2014
    Posts:
    32
    Another warning, about synchronization when baking anything: Make sure that the Playable Director update method is set to Game Time. DSP clock is for real-time playback only.
    upload_2020-7-1_11-34-13.png
     
    Dirrogate likes this.
  15. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,738
    @Matjio for some Reason it still doesn't work for me. :(

    I want to record Animation Clips from gameobjects in sync to music because I am basically trying to record a rythm based aniamtion that can be replayed in the timeline.
    Oddly enough when I simply use the example Code from the GameObjectRecorder Class it seems to work just fine:
    https://docs.unity3d.com/ScriptReference/Animations.GameObjectRecorder.html

    I have not yet tried to record something over a longer period of time so I don't know if the recording will still go out of sync over a longer period.

    The Timelie Recorder in comparison is completely unuseable for me, though. I notice drastically delayed/slowed down input during Play mode and while I try to keep in sync with music as soon as I load in the animation clip into the timeline I can immediately see that even over 1 - 2 minutes the clip is only half the length of the time it is supposed to be.
    As with the others in this thread the clip plays expectedly waaay too fast.

    The Playable Director is set to GameTime.
    I am using Unity 2019.4.4f1 LTS
    The gameobject recorded is using BOLT Scripts but the scene has only this one gameObject in it for testing reasons. So It's not likely that it's the overall scene performance capping the recording.
     
unityunity