UnityPlugin-AVProMovieCapture icon indicating copy to clipboard operation
UnityPlugin-AVProMovieCapture copied to clipboard

Investigate adding alternative offline mode of precise capture

Open vladtaranenkoSA opened this issue 3 years ago • 6 comments

Unity VideoPlayer component rendered with slowed down video

Reproduceable on iOS Unity VideoPlayer component on scene was rendered slowed down approximatively at x0.5 speed in captured video. Other objects on scene are moving at normal speed. Issue was discovered in version 4.7.3, reproduceable in 4.7.6 Not reproduceable on 4.4.1

Your Setup

  • Unity version: 2091.4.23f1
  • AVPro Movie Capture version: 4.7.3
  • Operating system version: IPhone XR, iOS 14.8.1
  • Capture component used: CaptureFromCamera
  • Capture settings (resolution, frame-rate, codec): MP4, H264, 720x1280, 30fps
  • Video file in Unity VideoPlayer component: MP4, H264, 592x1280 60fps 3566kbps

To Reproduce Steps to reproduce the behavior:

  1. Setup Quad with material with "Universal Render Pipeline/Unlit" shader and Unity VideoPlayer component on scene
  2. Record video with AVPro Movie Capture

Videos Capture from iOS https://drive.google.com/file/d/1_E1ZQs4WaW6zsgovEKPT8Sfd8hTyQb8L/view?usp=sharing Capture from MacOS https://drive.google.com/file/d/1Jk6RORjsLJAJHv_QdLkWsCrUZW2qd8N5/view?usp=sharing

vladtaranenkoSA avatar Jan 12 '22 14:01 vladtaranenkoSA

Have you tried changing any settings, e.g. changing the capture settings to 60fps, using a screen capture instead of a camera capture, etc? Are you using a realtime capture or offline render?

Would it be possible to send a sample reproducible project to [email protected]? Please include the issue number "152" in the subject line.

Thanks.

kahnivore avatar Jan 24 '22 15:01 kahnivore

Hi, we have 30 fps in camera capture settings or that is the output videos playback speed. And we have an offline render functionality. Would that have any effect that we are using an offline renderer? Should we configure something there? It would be nice to avoid 60fps and stick to what we have now in terms of settings.

I'll talk to devs and see if there is a sample reproduction project.

aengmo1 avatar Jan 27 '22 16:01 aengmo1

Offline rendering capture rate is not consistent - it basically captures as fast as it can. You could try a realtime capture, or using our video player plugin (AVPro Video trial).

We will however investigate adding support for a mode of offline capture where you can limit the capture to a certain framerate, although this is most likely only going to make it into our next major version. (ref precise framerates).

kahnivore avatar Jan 28 '22 14:01 kahnivore

Ok, then I interpret this as it is expected to behave like this, and if we are dependent on offline recording today to make the app work, we need to wait to next version?

aengmo1 avatar Jan 30 '22 20:01 aengmo1

A potential work around for now would be to lock iOS to whatever your desired frame rate is when using offline mode. You can do that by changing CaptureBase.cs. There should be a comment around line 1649 // Disable vsync, change the code that follows it to the following:

				// Disable vsync
				#if !UNITY_EDITOR && UNITY_IOS
					if (_allowVSyncDisable)
					{
						// iOS doesn't support disabling vsync so use _oldVsyncCount to store the current target framerate.
						_oldVSyncCount = Application.targetFrameRate;
						// We want to runs as fast as possible.
						Application.targetFrameRate = 30;
					}

Application.targetFrameRate being the important thing to set.

MorrisRH avatar Jan 31 '22 13:01 MorrisRH

thanks, will give it a try!

aengmo1 avatar Jan 31 '22 15:01 aengmo1