Converting Texture2D into a video
Hello,
I've did a lot of research, but I can't find a suitable solution for my application. I'm using a Fove-HMD and would like to record/make a video of the integrated camera. So far I managed to take a snapshot every update of the camera, but I can't find a way to merge this snapshots into a video. Does someone know a way of converting them? Or can someone point me in the right direction, in which I could continue my research?
public class FoveCamera : SingletonBase<FoveCamera>
{
private bool camAvailable;
private WebCamTexture foveCamera;
private List<Texture2D> snapshots;
void Start ()
{
//-------------just checking if webcam is available
WebCamDevice[] devices = WebCamTexture.devices;
if (devices.Length == 0)
{
Debug.LogError("FoveCamera could not be found.");
camAvailable = false;
return;
}
foreach (WebCamDevice device in devices)
{
if (device.name.Equals("FOVE Eyes"))
foveCamera = new WebCamTexture(device.name);//screen.width and screen.height
}
if (foveCamera == null)
{
Debug.LogError("FoveCamera could not be found.");
return;
}
//-------------camera found, start with the video
foveCamera.Play();
camAvailable = true;
}
void Update () {
if (!camAvailable)
{
return;
}
//loading snap from camera
Texture2D snap = new Texture2D(foveCamera.width,foveCamera.height);
snap.SetPixels(foveCamera.GetPixels());
snapshots.Add(snap);
}
}
The code works so far. The first part of the Start-Method is just for finding and enabling the camera. In the Update-Method I'm taking every update a snapshot of the video.
After I "stop" the Update-Method, I would like to convert the gathered Texture2D object into a video.
Thanks in advance
Answer by HeadGames115 · Aug 15, 2017 at 04:44 AM
Following this. I'm literally trying to do the same thing.
Your answer
Follow this Question
Related Questions
When I run getPixel32 () in WebcamTexture, only black pixels are returned. 1 Answer
How do play a video on top of a webcam texture on mobile? 0 Answers
How do I change the default picture compression from DXT1 to DXT5? 0 Answers
How to set up a Videocamcorder as a Webcam in Unity? 0 Answers
Video Recording in Runtime 0 Answers