RenderHeads / UnityPlugin-AVProMovieCapture

AVPro Movie Capture is a Unity Plugin for advanced video capture to AVI/MP4/MOV files
https://renderheads.com/products/avpro-movie-capture/
47 stars 8 forks source link

Video Player Offline Render Playback #209

Closed JudahMantell closed 1 year ago

JudahMantell commented 2 years ago

When trying to use the VideoPlayerController component to make Video Players work with offline rendering, the video player is slowed down to around 1 FPS in the final render.

My setup consists of a Capture from Texture component with a camera's render texture set up. The VideoPlayerController component is on the same GameObject as the capture component.

When I don't use the component, the video plays at regular speed, which doens't match the offline rendering, of course.

I tried setting the video player to match the Time.Timescale in update when it's recording, but it's always at 1.0. Setting it to unscaledDeltaTime helped it be consistent with the capture rate, but was still too slow.

If this controller script is not working, is there another way of using VideoPlayers with an offline rendering capture? (Other than purchasing your other video player asset which is out of my budget at the moment...)

Thanks!

Edit: I simplified some of my own attempts, and the component seems to be working a bit better, but the video player seems to start and stop. When it is running, it looks like the timing is correct though.

JudahMantell commented 2 years ago

Figured something out: Setting the Video Player's playback speed to this: float speed = Time.captureDeltaTime / Time.unscaledDeltaTime; every frame while the capture is recording, works perfectly for offline rendering.

Doesn't fix/explain the bugs with the VideoPlayerController component, but it's a good solution in the meantime!

Chris-RH commented 2 years ago

Ah, brilliant, that is very helpful, thanks! :)

Chris-RH commented 2 years ago

Can I just double check please, this is in Windows, yes?

JudahMantell commented 2 years ago

Yup, currently running Unity 2021.3 on Windows 11. Thanks!

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

JudahMantell commented 1 year ago

@Chris-RH So I have gotten bug reports from my users that my original solution doesn't work properly because over time the speed slowly gets slower throughout the capture of the video. Has any work been done on this note?

Or do you have any suggestions on fixing my suggestion to be more accurate to the way the plugin works?

Thanks!

Chris-RH commented 1 year ago
  1. Are these users all using Windows as well?
  2. What length are these videos?
  3. How long does it take before they start to slow down?
  4. Does it get slower at an even rate?
  5. Does it get back up to speed if you stop and then restart capture?
  6. What are the GPU/CPU/memory readings when it starts to get slower/as it gets slower?
JudahMantell commented 1 year ago
  1. Are these users all using Windows as well?
  2. What length are these videos?
  3. How long does it take before they start to slow down?
  4. Does it get slower at an even rate?
  5. Does it get back up to speed if you stop and then restart capture?
  6. What are the GPU/CPU/memory readings when it starts to get slower/as it gets slower?

Hi, thanks for the reply!

You can see a video overview of the problem with the original and videoPlayer overlayed to see the de-sync here: https://drive.google.com/file/d/1o-AZtrLdxqnEQ79IdvUCch9V7-FNEuJ-/view?usp=sharing

I'll be honest and say that the answer I'm looking for is more about what equation would be correct to set the playback speed to in the Update Loop (while recording only, of course). I did my best to go over the Capture scripts source code to see if I can figure out, but I came up empty. I'm hoping the RH team can shed some light on it.

I've tried the above code I mentioned, then also multiplying it by (captureFPS/videoFPS), but still no luck. I see that the capture scripts adjust different static Time properties, so maybe something with that?

Thank you!

Chris-RH commented 1 year ago

We're not entirely sure to be honest. Would you be able to send us a basic reproducible sample project at unitysupport@renderheads.com please?

JudahMantell commented 1 year ago

We're not entirely sure to be honest. Would you be able to send us a basic reproducible sample project at unitysupport@renderheads.com please?

Will do, thanks!

JudahMantell commented 1 year ago

I send an email to that address a few days ago, but figured I'd also share the reproducible project here as well if anyone comes across this issue in the future:


The project folder is linked below.

The SampleScene is what holds the most basic reproducible sample and everything set up.

Additionally, included is a clip from Johnny Bravo that I've been using for testing. If you record (by clicking the UI toggle) until the clip finishes playing, (about 66 seconds), and then take the resulting video and play it side by side with the original clip, you'll see the problem.

I'm using the most basic settings for the CaptureFromCamera component, just setting isRealtime to false inside the TestingScript (on ScriptHolder gameObject). That script also controls the playback speed, and is mostly self-explanatory.

My ideal solution would be to find the right equation to get a playback speed to set the video player(s) to in an Update loop while recording is happening. You can see my attempt in TestingScript.

[Please don't paste links to non-trial versions here]

Thanks!

Chris-RH commented 1 year ago

I've realised from looking at your project file that you are still using AVPro Movie Capture Version 4. Please note that this was depreciated in favour of Version 5 over 6 months ago, so there will be no further updates for it.

Having said that, have you tried using it with our other asset, AVPro Video? It includes support for offline capture (https://www.renderheads.com/content/docs/AVProVideo/articles/feature-video-capture.html). The trial version is available here: https://github.com/RenderHeads/UnityPlugin-AVProVideo/releases

JudahMantell commented 1 year ago

I've realised from looking at your project file that you are still using AVPro Movie Capture Version 4. Please note that this was depreciated in favour of Version 5 over 6 months ago, so there will be no further updates for it.

Having said that, have you tried using it with our other asset, AVPro Video? It includes support for offline capture (renderheads.com/content/docs/AVProVideo/articles/feature-video-capture.html). The trial version is available here: RenderHeads/UnityPlugin-AVProVideo/releases

Ah, I didn't realize that there was a new version available, thank you for letting me know! That being said, unless you drastically changed the way offline rendering works in that release, I believe the solution of finding the right values to set the video playback speed to, would be identical between the two versions.

Additionally, I have considered purchasing your video asset, but it's admittedly outside my current budget, and I can't use a trial version in my production app. I do hope I can upgrade to version 5 in the future as well, but it's not in my budget at this time either.

I understand you can no longer support an outdated product, but I'm not looking for a feature update or bug fix, but rather a hopefully simple solution to a problem that I believe would still be present in version 5 if it hasn't been addressed.

Like I said, because you guys know the way the system works better than myself, I'm sure the "magic formula" for playback speed is there somewhere :)

Thank you again for any help you can provide, I appreciate your time!

JudahMantell commented 1 year ago

Can you confirm that this issue is fixed in v5? If so, I am ready to purchase it and will do so shortly. If not, if I were to purchase it, would you guys be more available to help with this?

Thanks!

Chris-RH commented 1 year ago

I'm sorry, we haven't had much time to devote to this as we are a small team and we do external projects as well as these plugins.

I'm not sure v5 will show much improvement, but you are more than welcome to test it out. Free fully featured, watermarked trial version here: https://github.com/RenderHeads/UnityPlugin-AVProMovieCapture/releases

You might have better luck pairing it with AVPro Video as it does have a mode for Video Capture https://www.renderheads.com/content/docs/AVProVideo/articles/feature-video-capture.html Free fully featured, watermarked trial version here: https://github.com/RenderHeads/UnityPlugin-AVProVideo/releases

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically closed because it has not had recent activity. If you wish to continue this issue, then please create a new issue as we do not monitor closed issues.