FFmpegCapture.cs 755 Bytes
Newer Older
1
2
using UnityEngine;
using FFmpegOut;
3
4
5

public class FFmpegCapture : MonoBehaviour
{
6
7
8
    public CameraCapture cameraCapture;
    public bool useScreenSize = true;

9
10
    void Start()
    {
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
        if (cameraCapture == null)
        {
            cameraCapture = Camera.main.gameObject.GetComponent<CameraCapture>();
        }
        if (useScreenSize)
        {
            cameraCapture.height = Screen.height;
            cameraCapture.width = Screen.width;
        }
        cameraCapture.enabled = false;
    }

    public void StartCapture()
    {
        cameraCapture.enabled = true;
26
27
    }

28
    public string StopCapture()
29
    {
30
31
        cameraCapture.enabled = false;
        return cameraCapture.videoPath;
32
33
    }
}