How to export video? Cinemachine and Timeline question

It was my understanding that some of the hype over 2017 Unity, and I suppose Cinemachine, was that we would be able to export video files.

Am I mistaken, or just not able to find any documentation?

Certain things that used to allow me to save screenshots seem to have been specifically deprecated with 2017.0: Unity - Scripting API: Application.CaptureScreenshot

So, what is the deal? I can’t write to a PNG every frame, to later compile into a video - Cinemachine doesn’t add specifically the ability to export a video, Where is the Timeline documentation?

I understand that I can use OBS or FRAPS or similar, But if there is latency between the frames of rendering, built or otherwise, that will either show in the recording, or overload my CPU to skip tons of frame altogether.

How do I save the rendered frames in Unity to a video file?

If I can’t, then, How, now, do I write what the camera is rendering to a PNG file, before moving to the next frame?

I grabbed this from some documentation and modified it to make some files, which were iteratively named, albeit not to a “frames” folder as specified - it also did not make them as PNGs, I had to name them manually, and even then, it seemed to only produce the top couple of rows of what was being rendered, in a very very tiny image: using UnityEngine; using System.Collections;

public class WriteFrames : MonoBehaviour {
public string Screen_Shot_File_Name = “Ss”;
int i =0;

 public void LateUpdate (){
     i++;
     //if (snapping == true) {
         //Screen_Shot_File_Name = target.name + System.DateTime.Now.ToString ("__yyyy-MM-dd") + ".png";
         Texture2D tex = new Texture2D (Screen.width, Screen.height, TextureFormat.RGB24, false);
         tex.ReadPixels (new Rect (0, 0, Screen.width, Screen.height), 0, 0);
         tex.Apply ();
         byte[] bytes = tex.EncodeToPNG ();
     string filename = "/frames" + Screen_Shot_File_Name + i.ToString();
         //Write bytes
         System.IO.File.WriteAllBytes (filename, bytes);
         Destroy (tex); //Destroy texture from memory
         //Or use binary writer
         //System.IO.File file = new System.IO.File.Open(filename, System.IO.FileMode.Create);
         //System.IO.BinaryWriter binary= new System.IO.BinaryWriter(file);
         //binary.Write(bytes);
         //file.Close();
         Debug.Log ("Picture snapped!");
     //}

 }

}
So, that is not quite what I need, apparently, but might show you what my goal is. Please! Any help is appreciated.

Use can use GitHub - unity3d-jp/FrameCapturer: export framebuffer, GBuffer or any RenderTextures from Unity to file. supported format: png, exr, gif, webm, mp4 to save each frame to PNG

Hi,

It seems there (is ?) will be a native export tool to directly capture video in the Editor, as it was demonstrated to Unity Europe 2017 a month ago
(49:45 : Unite Europe 2017 Keynote - YouTube )

However I cannot see any trace of it right now… Hope someone could get a clue on this… :slight_smile:

btw, at UNITE austin 2017, unity rep showed that the 2017.3 beta lets you add a “recorder track” to Timeline, which spits out a .mp4 file (in near real time). (so i’m currently downloading the beta, so I can do this)
(i believe this was shown during Mathieu Muller’s “Unity For Film: A Walkthrough” talk, in Breakout2 room at 4:15 on Oct4)
EDIT:
it doesn’t appear to be native in 2017.3 beta (yet). but you can download it for any of the 2017.x releases here: https://assetstore.unity.com/packages/essentials/beta-projects/recorder-94079

  • and it seems a little wonky. You really need to open tools/record/video to do it. Just placing a recording track on timeline didn’t kick in and do anything. and the mp4 video it did generate for me was upside down. so. guessing it’s being actively modified at the moment)

can we make video clip export that??