Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity: Record video from device camera

I want a plugin or a library or a way to record video (sure with sound) in unity (windows standalone) from device camera.

Currently, I am able to take screenshots using this camera. Someone says that I can take many screenshots and convert it to one video file.

I found a plugin on Asset store called Camera Shoot

I want something like it but for windows.

Edit 1:

Now I am using a library that captures video from unity camera (virtual camera inside unity). I am previewing my camera feed on a canvas that is not shown in my application and I use this library to record this video.

This may solve my problem, but another problem was found that I need to record microphone voice to add this audio to the recorded video.

So now I am recording video (without sound) from the library, and record voice from microphone using another code, and after finish recording, I merge these 2 files together to get my desired file.

A new problem appears again. The merging process (muxing and compressing) takes a long time (more than 10% of the recorded time) which makes leads to many issues.

So I need another solution and prefered to be a plugin like the one above.

Edit 2:

I tried Unity VideoCapture Example in both editor and build. In unity editor, the application runs without errors but it didn't enter to this function "VideoCapture.CreateAsync()", as they said it didn't work with the editor.

When I tried to build to windows standalone build, it gives me this error : "Assets/Scripts/Controllers/Other/VideoCaptureExample.cs(4,26): error CS0234: The type or namespace name 'WebCam' does not exist in the namespace 'UnityEngine.XR.WSA'. Are you missing an assembly reference?"

like image 318
Bilal Sehwail Avatar asked Jan 23 '18 14:01

Bilal Sehwail


People also ask

Can you record video in Unity?

If you are using Unity 2019.2 or below, click here. The Unity Recorder is an Editor-only tool that allows you to record images or video of your project. It can be used to record trailers for your game, instructional videos for non-game projects, or for filmmaking.


1 Answers

After searching and working on this issue for about 2 months, I found Capture Manager SDK.

It is for windows but the author has 2 demos for unity to record screenplay and not the camera feed. I asked him if it can capture video from the camera and he made a unity example that do what I want.

I have tested the unity demo and it works as expected.

like image 184
Bilal Sehwail Avatar answered Oct 17 '22 06:10

Bilal Sehwail