using UnityEngine;
public class ScreenshotMovie : MonoBehaviour
{
// // The folder we place all screenshots inside.
// // If the folder exists we will append numbers to create an empty folder.
public string folder = "ScreenshotMovieOutput";
public int frameRate = 25;
public int sizeMultiplier = 1;
private string realFolder = "";
void Start()
{
// // Set the playback framerate!
// // (real time doesn't influence time anymore)
Time.captureFramerate = frameRate;
// // Find a folder that doesn't exist yet by appending numbers!
realFolder = folder;
int count = 1;
while (System.IO.Directory.Exists(realFolder))
{
realFolder = folder + count;
count++;
}
// // Create the folder
System.IO.Directory.CreateDirectory(realFolder);
}
void Update()
{
// // name is "realFolder/shot 0005.png"
var name = string.Format("{0}/shot {1:D04}.png", realFolder, Time.frameCount);
// // Capture the screenshot
Application.CaptureScreenshot(name, sizeMultiplier);
}
}
It is possible to save the screen as a continuous screen shot using the above code.
Question 1. Is there a way to play the saved screenshot back to Unity as a video using the above code?
Question 2. Is there any other way to record RGB images that appear on the screen (the screen taken by the Kinect camera)?
unity c# kinect
There will be a lot of performance problems when you take screenshots and encode and store videos directly.
The video recording function is often implemented using the native plug- We recommend using the plug-in that you have rather than making it yourself.
https://unity3d.com/unity/everyplay : Although there is less freedom in recording, I think everyplay is the best option to provide a function to share game play.
https://www.assetstore.unity3d.com/en/#!/content/2307: If you need to receive it as a separate file, it's expensive, but there's a plug-in like this.
© 2024 OneMinuteCode. All rights reserved.