Search Unity

  1. Tune in to get all the latest Unity news live from Berlin on June 19, 6pm CEST. Set up a YouTube reminder!
    Dismiss Notice
  2. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  3. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Video Unity Recorder update

Discussion in 'Audio & Video' started by ans_unity, Dec 19, 2017.

  1. roberto_pugliese

    roberto_pugliese

    Joined:
    Feb 12, 2018
    Posts:
    1
    Hello all, I was wondering how to record a video AND an animation at the same time. Is that possible with the current version of the recorder ?
    thanks!
     
  2. Parallax

    Parallax

    Joined:
    May 23, 2015
    Posts:
    28
    Default latest Recorder...Yes, with Time.timescale
     
  3. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    21
    @gokuartz SRP is not well supported with current recorder. At the moment we're still investigating the issues and how to fix them.

    @manran Are you using SRP? what recorder and what settings are you using?

    Thanks
     
    manran likes this.
  4. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    21
    Yes, you can use Timeline and have two Recorder Tracks in parallel, one for the video and the other for the animation.
     
  5. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    21
    Ok, can you also share a capture of the Recorder settings you're using to generate the video?
    Thanks
     
  6. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    44
    Is there an example of basic api usage?..I just need to know how to setup a timeline and start a recording session via script. Thx
     
  7. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    21
    Current version of the recorder API is limited to Editor scripts only and cannot be used in a Monobehaviour. However, if your scene already use a Timeline with a Recorder Track, then you simply need to play it by calling
    gameObject.GetComponent<PlayableDirector>().Play()


    I hope this helps.
     
  8. manran

    manran

    Joined:
    Jan 30, 2014
    Posts:
    34
    Hi I'm using HDRP , the recorder version is 0.2.0032 , attached is the config setting and it crashes everytime i hit start recording. thanks
     

    Attached Files:

  9. Alex_May

    Alex_May

    Joined:
    Dec 29, 2013
    Posts:
    98
    @chafik_unity Hello! I notice you say the Recorder API cannot be used in a MonoBehaviour. However, the RecorderComponent itself is a MonoBehaviour. I also note that the MovieRecorder, which deprecates the MP4 recorder, is put in the UnityEditor namespace. Is there a reason for this? And do you have an estimate for a time when the API might be callable from script? We are attempting to create an app that allows the user to export video, so that means from builds and not from the Editor.
     
  10. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    21
    Config settings looks correct. Do you have the call stack of the crash?
    Thanks
     
  11. manran

    manran

    Joined:
    Jan 30, 2014
    Posts:
    34
    Here is a sample error log file
    Thank you
     

    Attached Files:

  12. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    21
    Hi @Alex_May.

    The RecorderComponent is only used as a scene hook while a recording is active so it cannot be used alone as is.

    The recorder is intended to be used from the Editor only (some recorders, like the MP4Recorder might work at runtime but has not been tested on our side) so to avoid confusion it has been placed in the UnityEditor namespace.

    Just to be clear, calling the recorder API from a MonoBehaviour is not the same as calling the recorder API at runtime.
    There's unfortunately no plan to make the recorder API available at runtime at the moment.

    Thanks
     
  13. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    21
    This is a serious bug. Can you please file in a bug report for it?

    Sorry for the back and forth.
    Thanks a lot
     
  14. spaghettiboy

    spaghettiboy

    Joined:
    Jun 20, 2015
    Posts:
    1
    Is there a way to input a custom resolution while rendering video? I'm rendering content for a panoramic LED screen at resolution (9920 x 720) and setting the Output Resolution to Window doesn't work due to:
    GameView reduced to a reasonable size for this system (8192x594)

    The final output gets reduced to 8192 x 594
     
  15. manran

    manran

    Joined:
    Jan 30, 2014
    Posts:
    34
    oki i'm gonna fill a bug report
     
    chafik_unity likes this.
  16. Joybutton

    Joybutton

    Joined:
    Jun 25, 2014
    Posts:
    3
    I've been using the Unity Recorder with good results for some time. Recently after updating my projects to 2018.1 I'm finding that everything I record is very very dark. Bright areas are still bright but everything else is crushed down to almost black colors.

    This project does contain some older assets from 2017 like the previous post processing and cinemachine. Could those be the cause? This is for a completed project so I would like to limit the refactoring as much as possible.

    I'm trying to downgrade the project to 2017 now and see if I have the same results since I do not believe I've added any 2018 specific assets or features yet. I'll report back with the results but it will take some time to convert all the scripts.

    Thank you for your time!

    Update: After downgrading to 2017 everything looked good in the editor but showed nothing but purple when hitting play. Rebaking all the lighting and double checking all the materials textures had no effect. I did get an error regarding the allegorithmic plugin being disabled by the in-editor converter so that may be the cause

    Update: Back in 2018.1.Testing different settings shows the problem doesn't occur when I uncheck 'Capture UI'. I'm trying to see if I can find the cause. It looks fine in the Game window. I need the UI layer to handle masking and fades

    Update: I've always used 'Specific Camera(s)' as my collection method. Trying the others I did find if I set the Collection method to 'Game View' it recorded like it used to with 'Specific Camera(s)' and 'Capture UI'. As long as there's no quality difference this works to keep us going, but I'm not sure what caused the change.
     
    Last edited: May 27, 2018
  17. AlexiJohansen123

    AlexiJohansen123

    Joined:
    Apr 5, 2016
    Posts:
    8
    Can this record on Android and Ios? And can it record other things than the screen? Can I feed it a texture/rendertexture?
     
  18. Alex_May

    Alex_May

    Joined:
    Dec 29, 2013
    Posts:
    98
    Thanks Chafik.

    Do you think that the UTJ FrameCapturer plugin can be used at run time?
     
  19. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    519
    Hi
    Could you post 'best practice' for VR recording please?

    I'm trying to record my mobile VR game (GoogleVR API). After quite a bit of fiddling, I'm using settings as shown:
    Screenshot 2018-05-27 16.59.16.png

    This successfully creates a movie but has a few issues:

    Performance
    Recording happens about 1 FPS. Obviously that's not practical for recording an interactive session. My video (non-searchably here if you're curious) ends up veeeery speedy -- much better when viewed at x0.25 speed or with a lot of pausing! Unless I can improve this, I guess I'll have to script movement and interaction somehow (perhaps via Timeline?).

    VR Sickness risk
    If I stick with my current system, recording MainCamera includes the orientation of the camera in the recording. I feel this is probably undesirable or at least ought to be optional. I tried placing a separate camera on a GameObject that tracked my player's head (but not the rotation). Annoyingly, that camera was rotated by the GVR code as well so ended up with the same result *minus* the omission of culling (which is a nice touch, btw!).

    Quality
    The other thing that slightly disappoints is the output quality. As others have mentioned, there's quite a lot of compression corruption on the output. Am I right in thinking that that report to the responsible Unity team will hope to improve this? If not, are there other things I should be trying?

    Resolution
    I'd like to record at vertical 1080 per eye. That's 2160 vertical. However the Editor complains that I must use a power of 2. 2048 is obviously slightly below so 4096 is the best I can do. Is there a way to remove this restriction?

    Cube Map Width
    I couldn't find explanation of what this setting does in the docs. I figured to set it to 4096 in case it's a limiting factor on width.

    Lastly, despite all my issues, I would say this is a great asset (especially for the price I paid for it ;) ) Thanks and keep up the good work!
     
  20. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    519
    P.s. just profiled recording and see Gfx.ReadBackImage() is the main culprit!

    Screenshot 2018-05-28 15.30.41.png

    I'm probably going to regret asking this since I know this is a really impertinent and hence dumb question but I've worked in big companies and know sometimes lots of stuff happens without other parts knowing so.... um, have you considered using the delicious new AsyncGPUReadback API where available?
    If not (and yes here I go again "teaching granny to suck eggs") would any of the things mentioned in this fascinating post be viable?
    (<ducks!> I'm no expert so please don't slap me too hard for my naivety! :D )
     
    Alex_May likes this.
  21. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    519
    So I couldn't resist. I had a little play at implementing using that API. Results were ... mixed?
    Here's the recording:
    (again not searchable since it's not great)

    This started off recording at about 5 FPS = a great improvement from ~0.5 FPS. It works very nicely for about 72 frames,... then it all slows to a crawl. By 130 frames, it's one every 2 seconds. Deep profiling this says MediaEncoder is becoming slower and slower -- that's native level! (see pics) So probably I've done something dumb maybe involving native resources. Any hints?

    Screenshot 2018-05-28 17.20.58.png Screenshot 2018-05-28 17.21.05.png Screenshot 2018-05-28 17.21.09.png

    I haven't done the audio side of things -- I simply commented-out the audio sections in the code. I expect that would need bufferring in some callback structure that can be checked... unless one can feed the encoder with time-stamped data?

    I can post a proper patch but it's roughly this:

    MediaRecorder.cs:
    Code (CSharp):
    1. // line 239:
    2.                 AsyncGPUReadback.Request(input.outputRT, callback:afterCallback);
    3.                 return; // skip all the audio stuff for now
    4.  
    5. // afterCallback is a Action<AsyncGPUReadbackRequest> set to after in BeginRecording()
    6.  
    7.         private void after(AsyncGPUReadbackRequest asyncGpuReadbackRequest) {
    8.             if (asyncGpuReadbackRequest.hasError) {
    9.                 Debug.LogErrorFormat(this, "Error reading data async: {0}", asyncGpuReadbackRequest);
    10.                 return;
    11.             }
    12.  
    13.             var data = asyncGpuReadbackRequest.GetData<Color32>();
    14.             m_ReadBackTexture.LoadRawTextureData(data);
    15.             m_ReadBackTexture.Apply();
    16.             //data.Dispose(); -- not needed, otherwise gives:
    17.             //  InvalidOperationException: The NativeArray can not be Disposed because it was not allocated with a valid allocator.
    18.             m_Encoder.AddFrame(m_ReadBackTexture);
    19.         }
    Well, for recording a short section interactively, this seems like it helps :)
     
  22. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    519
    oh ok, well I don't feel so bad now...
    I went for a reproduction in a minimal project (Unity 2018.2b5 + UT Recorder + 1 scene with a bouncing ball + cloth + same settings as before with vertical 2048).

    First, checking without my code first and... oh, yep problem was there before I added my code.

    First pic when running OK, second after frame 74.
    Screenshot 2018-05-28 20.17.01.png Screenshot 2018-05-28 20.16.22.png
     
  23. Alex_May

    Alex_May

    Joined:
    Dec 29, 2013
    Posts:
    98
    Does anyone know which shader is used for copying the frame buffer? the fcAPI references an asset ID that doesn't exist:
    Code (CSharp):
    1.  
    2.             return AssetDatabase.LoadAssetAtPath<Shader>(AssetDatabase.GUIDToAssetPath("2283fb92223c7914c9096670e29202c8"));
    edit: the shader is called CopyFB.shader and is part of the Recorder asset
     
    Last edited: May 29, 2018
  24. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    21
    Hi @Arkade, thank you so much for the great feedback and suggestions! I'll let the VR team know about this and see how to improve and optimize the VR recording workflow for next releases!
     
  25. chafik_unity

    chafik_unity

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    21
    Unity automatically reduces the GameView size when it's too large.

    However, you can try to use a RenderTexture to bypass this limitation.
    Try to :
    - Create a RenderTexture with a size of 9920x720
    - Assign this RenderTexture to your main camera
    - Record from the RenderTexture instead of GameView

    Hope this helps.
     
  26. Alex_May

    Alex_May

    Joined:
    Dec 29, 2013
    Posts:
    98
    I can confirm that using MovieRecorder at run time works on Windows with the problems below, some of which are reported further up in the thread:
    • Bit rate is far too low, and can't be set.
    • Renderer slows to a crawl after about 5s.
    • Even if framerateMode is set to constant, the recording process quits after the real time passed in has elapsed, so e.g. if you set a 10s time for recording, you get about 5s of video because the renderer drops to 1fps after 5s but the timer seems to continue despite this. My expectation was that the timer would be increased as frames are processed.
    • The recorder will not work at all unless you hack the CopyFB.shader shader into the copy shader field of the recorder. The file is referenced in Editor-only functions in the fcAPI static class. You can just assign it to the copy shader in the recorder. This is the only file you need outside of the UTJ folder.
    • Even with the above shader, rendertexture rendering does not work and you have to use framebuffer rendering.
     
  27. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    347
    What is the best way to record manually record single screenshots? I'm using the following settings, but after taking the first screenshot, the only option is to press "Stop Recording" which also stops the program itself. I would like to be able to take a screenshot without stopping the program. Thanks!

    recorder.PNG
     
  28. scottunity

    scottunity

    Joined:
    Feb 1, 2014
    Posts:
    62
    I'm having a few issues with 360 video recording. Latest Unity (2018.1?)

    In this test I've taken the 3D Game Kit, plunked in a camera in level 2 to use as my recording camera (with tag)
    I'm render 2048 x 2048 or 4096 x 4096 stereo. (so 2:1 for each view)

    On Mac it was fine but on Windows it was way too dark. So switched to Gamma on Windows which looks odd in the editor but records better. Better, but still not matching the 'normal' render.

    Also having issues with ghosting of the images. If there's a person or object in the scene, there's a ghost of the person/object offset.

    Clipping planes - Bits and pieces of the background are culled evidently? Even the Ellen character is missing part of her face.

    Stereo 360 - Not working. While it renders and there's a psuedo stereo effect it's not correct. I had through it was revering top/bottom but that didn't not fix the problem.
     
  29. scottunity

    scottunity

    Joined:
    Feb 1, 2014
    Posts:
    62
    --------
    Update 6/7/18
    Some of the clipping and ghosting anomlies seem to be from trying to use 3D Game Kit as an example. It would be great if it worked but seems like there's some post processing effects that conflict with the recorder(?)

    Stereo still broken on simple scenes. Maybe the top and bottom are swapped from industry standards since it looks like swapped eyes?
     
  30. manran

    manran

    Joined:
    Jan 30, 2014
    Posts:
    34
    UPDATE : I'm now using the HDRP version 2.0.0 preview and the recorder is working :)
     
  31. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    402
    This is a great tool with huge potential, but seems very buggy now.
    I am using Unity 2018.1.1

    When opening the project, the recorder window always welcomes me with the message "The exception was raised while editing the settings. This can be indicative of corrupted settings." and the button "Reset settings to default".

    Afler clicking the "Reset" button I have tried to record a 3600 frames long cinemachine movie to video 360 with settings same as @Arkade, but mono. It always broke Unity around some 900 frames or less "We will now try to find a fix... ...There is no fix available...".

    So I have found the recordes has a number of working modes, so possibly I could use the Frame Interval mode and record it by 6 pieces, each600 frames long and then stitch it together.

    But these modes other than manual generally do not seem to work when the the starting frame is other than 0. Once, when I set the starting frame to 2000 the recorder made me wait for ages "skipping frames" and then started recording at 0 frame anyway.

    The image sequences work up to 4096 px.
    This is a mono image 4096x2048 uploaded to the 360player site.
    360p.png
    4096x2048 is the 360 player site reccomendation for the low resolution images, and 8192x4096 is the high resolution recommendation. But at 8192 the recorder produced nothing, but black images only.

    But I would like to stress I believe the tool is great and I hope this would help to make it better rather than discourage the plugin's authors.
     
    Last edited: Jun 12, 2018
  32. guclusen

    guclusen

    Joined:
    Nov 22, 2017
    Posts:
    2
    Hi Everyone.
    I've almost used every possibilities of the all settings but output video always low resolution and very very blurry.
    including FullHD, even 4K settings. Files are 4K but videos are strange dark and blurry.
    My game view window is normal and clear. I wanna export some cool videos in game but I couldn't.

    I've tried to use whole recorder "Unity Video" and "UTJ" settings.
    I'm using v.2018.1 Unity

    I don't understand what am I doing wrong. Can you help me? Capture.JPG
     
    Last edited: Jun 12, 2018
  33. jp-weloveanimation

    jp-weloveanimation

    Joined:
    Mar 6, 2018
    Posts:
    2
    Hi everyone,

    I'm trying to create a editor tool to create Recorder Tracks and add a RecorderClip.

    Code (CSharp):
    1. private static void CreateRecorderTrack(TimelineAssettimeline)
    2.     {
    3.         var track = timeline.CreateTrack<RecorderTrack>(null, "RecorderTrack");
    4.         var clip = track.CreateClip<RecorderClip>();
    5.  
    6.         // option 2
    7.         //var clip = track.CreateDefaultClip();
    8.         //RecorderClip recorderClip = clip.asset as RecorderClip;
    9.  
    10.         AssetDatabase.CreateAsset(timeline, "Assets/Timeline.playable");
    11.     }
    The recorder track with his recorder clip is generated, but when i click the recorder clip the settings are missing and console throw errors.

    Probably i missing something in my code, maybe is necessary generated a setting scriptable object and add it to the RecorderClip.

    Can someone help me?

    Edit: I found the solution, actually the timeline save asset must be done first, or the modifications are not saved.
     

    Attached Files:

    Last edited: Jun 12, 2018
  34. jp-weloveanimation

    jp-weloveanimation

    Joined:
    Mar 6, 2018
    Posts:
    2
    In relation to my previous question,

    Exist anyway of change the RecorderClip settings by script (Edit mode). For example the collection method or output path.
     
  35. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    402
    I have tried to make a 4k video with these settings:
    recorder settings.png
    I consider the results as quite satistactory:

    (On Firefox I can see only up to 1080p options, on Chrome all up to 2160p)
     
    Last edited: Jun 13, 2018 at 7:09 AM
    Arkade likes this.
  36. guclusen

    guclusen

    Joined:
    Nov 22, 2017
    Posts:
    2

    Thanks, I tried that way but it was blurry again.
    I guess this tool works fine but I have another problem.

    2.JPG

    I couldn't understand clearly, My project's resolution is 1920x1080. And My Operating system is 1920x1080.
    Game view is clear. "Free Aspect "and "16:9" is very cool and clear.

    Last screenshot; when I change the game window as 1920x1080, the view is turning blurry.
    "Recorder" use the 1920x1080 view I guess and result is turning blurry.

    But I tried something; I changed my project settings and also my windows display options 3840x2160.
    Same problem continues.
    My project's resolution is 1920x1080 --> game window FHD view is blurry.
    My project's resolution is 3840x2160 --> game window FHD view is blurry again.

    At last, rendered videos that I got are all blurry.
    I couldn't understand what that problem is. What am I doing wrong?

    3.JPG 4.JPG
     
  37. anthonydavies

    anthonydavies

    Joined:
    Mar 15, 2016
    Posts:
    1
    I'm using this with a scene that has the Unity Video Player component playing on a TV inside the scene. The video in the player is at 30fps and the Recorder Target fps is set to Custom > 30fps. But in the recorded capture the video is running at about 6x speed. How to fix? Thanks
     
  38. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    407
    I just tried the 360 degree recording again, using Unity 2018.1.4f1 and Recorder from today's Asset Store version. Result:

    * rendering to Render Texture only gives a black screen
    * 360 View doesn't respect the camera position, it always records at position 0 / 0 / 0

    Is there a more recent version one could try? The one on the Asset Store is from April.
     
    Last edited: Jun 14, 2018 at 5:40 AM
  39. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    402
    Neither position nor orientation?

    I got confused a bit with my recordings done from cinemachine camera (in 2018.1.1).
    I had a number of cameras moving along the DollyTrack and finally it worked fine, when I left only one of them active and disabled the rest.
    But the movie orientation is always at 0/0/0 no matter of the camera initial orientation.
    Obviously the camera position should be respected, but the orientation should not change during recording, because it should be left to the user when watching.
    Then if you need to change the starting orientation, you have to do it when publishing.
     
  40. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    407
    I only checked the position, because as you say for the 360 degree video the orientation doesn't matter.