Search Unity

Question Assigning Unity Recorder Source(Image Source)

Discussion in 'Audio & Video' started by TheLowestAnimal, Aug 20, 2020.

  1. TheLowestAnimal

    TheLowestAnimal

    Joined:
    Jun 29, 2013
    Posts:
    5
    https://docs.unity3d.com/Packages/com.unity.recorder@2.0/api/UnityEditor.Recorder.ImageSource.html

    I don't quite understand how to apply the Image Source for the Unity recorder pkg, any example of practiacal application of it would be greatly appreciated!

    I thought it would potentially be passed back up from the recorder settings & piped into the controller but no luck. And looking from the documentation it appears that it's an enum which I'm guessing is acessed at a higher level. I don't see any utility for Image source within the controller itself which is stated via the documentation to be the "main"/core class here?
     
  2. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    Hi @TheLowestAnimal,

    the Image Source is which camera to grab for your recording. If you are confused, maybe looking at the Recorder Window in the Editor would help you understand it. This also explains it: https://docs.unity3d.com/Packages/com.unity.recorder@2.0/manual/RecorderMovie.html

    Here is some scripted recording code that shows how to use the enum:
    Code (CSharp):
    1.  
    2. var recorderSettings = ScriptableObject.CreateInstance<MovieRecorderSettings>();
    3. recorderSettings.FrameRate = 30.0f;
    4. recorderSettings.name = "Test Video Recorder";
    5. recorderSettings.Enabled = true;
    6. recorderSettings.CaptureAlpha = false;
    7. Assert.IsNotNull(Camera.main);
    8. recorderSettings.ImageInputSettings = new CameraInputSettings
    9. {
    10.     Source = ImageSource.MainCamera,
    11.     OutputWidth = 640,
    12.     OutputHeight = 480,
    13.     //CameraTag = "MainCamera", // change to another tag if using ImageSource.TaggedCamera
    14.     RecordTransparency = false,
    15.     CaptureUI = false
    16. };
    17. recorderSettings.AudioInputSettings.PreserveAudio = true;
    18.  
    19. ...
    20.