Unity-Technologies / GenericFrameRecorder

This GitHub package is DEPRECATED. Please get the new Unity Recorder from the Asset Store (https://assetstore.unity.com/packages/essentials/unity-recorder-94079) Use the editor builtin Bug Reporter to report issues. You can track and vote for issues on the Issue Tracker (https://issuetracker.unity3d.com)
MIT License
534 stars 66 forks source link

Video Player components play too quickly when recorded #78

Open dongle opened 6 years ago

dongle commented 6 years ago
What happened?

I have a unity scene with a gameobject with a videoplayer component. In the editor and the standalone player, the video plays at the correct speed. (Eg, it is a nine minute video and it plays for nine minutes from start to finish.) When using the recorder with 30fps constant settings, the video is over around the 5500th frame (it should fill the entire span of 16200 frames for a 540 second recording).

Is it reproduceable?

Yes – tried with several videos.

Released package version / tag?

0.2 from Asset Store

Unity version, operating system, target platform (standalone windows, mac, iOS, PS4...)?

Unity 2018.1f

dustinfreeman commented 6 years ago

I'm also having issues with the VideoPlayer component playing too slowly. I'm rendering a 360 scene, but inside that scene there is a VideoPlayer component playing on a 2D TV screen.

I'm using GenericFrameRecorder's latest version on this repo as of now (0fffbdaa6a505271ead2acf977a9d0509192589d). I'm in Unity 2018.1.0f2

@dongle Did you ever figure out a fix?

dongle commented 6 years ago

I never figured out a fix. I wound up running the project while screencapturing it which worked well-enough in this case but limits me for future projects.

dustinfreeman commented 6 years ago

That's a decent hack. And now I'm wondering if my solution will be to create an game window output mimicking 360 video capture. Terrifying, but it might be my only option.

Luzido commented 6 years ago

Hi, I have the same problem and the same request. As I see it, the VideoPlayer outputs the video in realtime but the GenericFrameRecorder takes longer/shorter to render a frame thus resulting in lagging or sped up image sequences. I imagine that the videoplayer needs a function which scales the time accordingly. I want to record a 360° stereoscopic video and it's nearly impossible to get the videos inside the scene and the recorded endresult to the same speed... Any fix?

dustinfreeman commented 5 years ago

I wrote a piece of code on a video object that pauses the playing video, then manually increments a frame each time a frame is rendered in Unity.


void Update() {
        ...
        if (kioskVideoPlayer.isActiveAndEnabled) {
            kioskVideoPlayer.Pause();
            kioskVideoPlayer.StepForward();
        }
}
antdavies commented 5 years ago

Great solution! Works well for me

adkehn commented 3 years ago

Sorry to add to this post 2 years later, but running into this issue. The code to manually increment each frame works well, only now I've lost the ability to loop the video. Simply adding videoPlayer.isLooping doesn't quite work since it will only loop once .Play() has been called (or so it would seem). Was just taking shots in the dark and added .Play() after .StepForward() hoping that it would trigger the loop function on the last frame, and it did, however once it loops it plays at the wrong speed again.

Thought I could manually reset the frames as well however I'm a bit confused by the frame and frame count using long/ulong to store their values. If anyone has any guidance on a fix for this it'd be greatly appreciated! Again sorry to dig up an old thread, hopefully it might help someone else as well.

leavittx commented 2 years ago

For everybody interested in network synced/manually-driven video playback: http://u3d.as/2KgC

rafaelski commented 1 year ago

I wrote a piece of code on a video object that pauses the playing video, then manually increments a frame each time a frame is rendered in Unity.

void Update() {
        ...
        if (kioskVideoPlayer.isActiveAndEnabled) {
            kioskVideoPlayer.Pause();
            kioskVideoPlayer.StepForward();
        }
}

You saved my life, my job, and my mental health. Thank you s2