- Home /
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: https://docs.unity3d.com/ScriptReference/Application.CaptureScreenshot.html
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.
I just found this : http://unitylist.com/r/bw8/generic-frame-recorder
Hope this might help :D
Answer by julienb · Jul 26, 2017 at 09:59 PM
Use can use https://github.com/unity3d-jp/FrameCapturer to save each frame to PNG
Answer by tlopez_technicolor · Jul 27, 2017 at 02:29 PM
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 : https://www.youtube.com/watch?v=-jZdMFPACpU )
However I cannot see any trace of it right now.... Hope someone could get a clue on this.... :)
https://github.com/Unity-Technologies/GenericFrameRecorder This one let's you record your video. The one that $$anonymous$$$$anonymous$$yhill showed in the Unite $$anonymous$$eynote.
If anyone still looking for this tools for recording videos and exporting it from Unity, you can check for Recorder on the Assetstore, it works alongside cinemachine as far as I know.... and here's a tutorial showing how to use it on Youtube:
https://www.youtube.com/watch?v=Fd85Dm$$anonymous$$r4pU
and here's a link to find it on the asset store:
https://assetstore.unity.com/packages/essentials/beta-projects/recorder-94079
Answer by warrenblyth · Nov 16, 2017 at 01:18 AM
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)
Your answer
Follow this Question
Related Questions
Unity - blur on one camera effects the other as well 0 Answers
rgb value detail 0 Answers
Is it possible to view two camera at the same time? 2 Answers