Search Unity

Video Unity Recorder - Custom bitrate?

Discussion in 'Audio & Video' started by Raul_T, Apr 21, 2019.

  1. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    Hello, we are currently using the Recorder package with the Timeline to create a cinematic from our game, and we render the timeline to mp4.

    I've noticed the only setting related to encoding is the quality, which is just 3 options, Low, Medium, High. Is there any way to set up a custom bitrate for the recorder?

    Even on "High" quality setting we find the output videos to be not usable for anything else than just previewing. (not sure if this is a bug or the bitrate on High is not that "High" :D ) There is a lot of motion in the cinematic, higher bitrate is needed for us, otherwise parts of it are a compressed mess.

    Thanks
    Raul @ MadGoat
     
  2. marief_unity

    marief_unity

    Unity Technologies

    Joined:
    Oct 9, 2018
    Posts:
    142
    Hey @MadGoat and @zombieguy,

    This is a known problem.

    See more information here: https://forum.unity.com/threads/unity-recorder-update.509458/page-6#post-3866131

    That said, in the meantime, here are some workarounds you could try :
    - Use Legacy MP4 Recorder that allows you to set the bitrate (you need to check the "Show Legacy Recorder" in the Window > General > Recorder menu)
    - Export an image sequence and then use a third party to encode into a movie

    Thanks you so much for your patience, improving this is in the roadmap but we had/have to work first on core features / fixes !
     
  3. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    Thank you for the detailed answer!

    Will definitely check out the legacy recorder then!

    On a side note, we used the image sequencer render before, but we decided to switch to mp4 due to the fact that for us it's easier to handle audio directly in unity (with animation events and Timeline) rather than having to import and sync all our audio tracks in Premiere, for example. My guess would be that rendering once as image sequence for the video part and once as mp4 for the whole audio track then only take the audio from the mp4 would also work.

    And no worries. We get that the package is still just a preview, and we are looking forward to see improvements! It really is a must have for any cinematic project :)
     
  4. marief_unity

    marief_unity

    Unity Technologies

    Joined:
    Oct 9, 2018
    Posts:
    142
    Hey @MadGoat !

    You could give a try to AudioRecorder.
    The only issue is that for now it is not integrated to plain Recorder (on the TODO list).

    So to work with Packages Recorder it requires some package tricks.
    Here's a step by step :
    - copy recorder package folder (com.unity.recorder@2.0.0-preview.6) from package cache (/path/to/project/
    projectName/Library/PackageCache/) and paste it where you see fit
    - Download the three AudioRecorder files here : https://github.com/Unity-Technologi...AudioRecorder/Sources/Recorders/AudioRecorder
    - In your package copy, create AudioRecorder folder in /path/to/copy/com.unity.recorder@2.0.0-preview.6/
    Editor/Sources/Recorders/ and move the 3 scripts here
    - Update your package manifest to use the package copy :
    - open /path/to/project/projectName/Packages/manifest.json
    - change recorder line to : "com.unity.recorder": "file:/path/to/copy/com.unity.recorder@2.0.0-preview.6",​

    Anyways, thanks for your feedbacks :)
     
    Raul_T likes this.
  5. Raul_T

    Raul_T

    Joined:
    Jan 10, 2015
    Posts:
    363
    Thanks :) Will check out!
     
  6. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    I tried this to no avail.
    - Using Legacy MP4 renders an invalid MP4 file
    - Using Legacy WebM will never finish (I rendered a 20 minute video last night, got 20% done overnight.
    - Using current MP4 or WebM formats result in a useless video because the bitrate is far too low.

    We're still using third party tools to export via image sequence and assemble an MP4 using FFMPEG. After 1.5 years is there ANY hope that Unity will release a production ready Recorder?
     
    Last edited: Jul 12, 2019
  7. marief_unity

    marief_unity

    Unity Technologies

    Joined:
    Oct 9, 2018
    Posts:
    142
    Hey @Selzier,

    As mentioned in various threads, Recorder is currently using Unity Core and each OS Video API to produce those movies, which is not an ideal solution cause it limits us in term of release timeline but also in term of feature and options we can offer.

    So we are aiming at something slightly different : having a core media API + encoder plugins that will allow the users to choose the encoder they want (ex: Unity core plugin based on OS API, ffmpeg plugin...). Of course, this will include access to the proper quality parameters.

    We are working on this as I speak, but good solution takes time.

    Question:
    Would you mind sharing more details ? (Unity version, OS version). Cause this should work.

    Thanks
     
  8. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    6 months later, similar problems: On Windows10, with Unity 2019.2, the MP4 mode for latest Unity Recorder is basically useless, it uses a bitrate so low it's embarassing (it looks like a flash video from 1999 - it's a waste of time). I can get better results by switching to the .webm exporter, but it's still a moderately low bitrate that makes even HD export (let alone 4k!) pointless, because Unity is downsampling so badly you can't actually see the render quality that Unity is doing within the pipeline.

    It is just about bearable if you have a scene with little or no moving objects (or small objects moving slowly, and a static camera). It feels like putting the engine of a 20 year old banger inside a Ferrari: Unity3D has done all this great rendering work, and the Recorder throws it all away.

    (This is Recorder version 2.0.3, running on an AMD Ryzen, and maxing out at approx 60% of CPU usage, and the GPU fans running at half speed - so it's not even resource-constrained, it's just the Recorder doing a bad job :(.)

    @marief_unity Do we have a workaround yet for this?
     
    Mehrdad995 likes this.
  9. Can-Baycay

    Can-Baycay

    Joined:
    Dec 14, 2010
    Posts:
    27
    Any news on this? @marief_unity
     
  10. JohnAustinPontoco

    JohnAustinPontoco

    Joined:
    Dec 23, 2013
    Posts:
    283
    Presumably the ProRes encoder fixes this. Seems like it has quite a few high quality options.
     
    unitybru likes this.
  11. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    Yes, just use Recorder 2.4.0 with ProRes.
     
  12. JohnAustinPontoco

    JohnAustinPontoco

    Joined:
    Dec 23, 2013
    Posts:
    283
    Is there any chance that ProRes will ever support variable frame rates? We use that feature heavily to record playback during edit mode (when constant framerate recording would interfere with gameplay).
     
  13. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    Can't promise anything, but we're aware that some users need it and it's definitely feasible.
     
    JohnAustinPontoco likes this.
  14. Tomer-Barkan

    Tomer-Barkan

    Joined:
    Jul 31, 2012
    Posts:
    150
    Had the same problem, MP4 is worthless for recording unfortunately. Luckily ProRes works well enough. Huge files and not the best format out there, but I can always downgrade it with a video edit software later.

    Really hoping that options to control the codec (color format, bitrate, etc) will be added, because this tool is amazing! Being able to simulate the game at constant framerate for recordings without any stutter or lag is amazing.
     
  15. Sybaris

    Sybaris

    Joined:
    Aug 19, 2013
    Posts:
    91
    @marief_unity Anything new on this issue?
    I'd like to record a high quality video via a recorder track in a timeline but what I get is horrible.
    Using the legacy MP4 recorder doesn't help because it obviously does not record virtual cameras with storyboards - it just shows the main camera view.

    May I quote: We are working on this as I speak, but good solution takes time.
    It is two years after the first post of this thread and almost a year after that statement...
     
    KamilCSPS likes this.
  16. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    448
    Would like to +1 this as well.

    Would love to have good quality MP4 footage without having to do 4k and downscale.
     
  17. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    Can you use ProRes instead?
     
  18. Sybaris

    Sybaris

    Joined:
    Aug 19, 2013
    Posts:
    91
    Nope.
    This video is going to be a public download/stream, so I have to stick to a popular format that is available everywhere.
    To be honest: don't you think that one year is enough for a "good solution"?
     
  19. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    Doing this requires work not only in the package but also on the side of Unity Core. We have been working on a lot of bugfixes and stability.

    If you really need more control over the MP4 settings, you can always use Recorder 2.6.0-exp.4 or earlier and enable the legacy recorders to use the Legacy MP4 recorder, which exposes more settings.
     
  20. Sybaris

    Sybaris

    Joined:
    Aug 19, 2013
    Posts:
    91
    As I wrote:

    Using the legacy MP4 recorder doesn't help because it obviously does not record virtual cameras with storyboards - it just shows the main camera view.

    At the moment I'm rendering images and put them together via ffmpeg.
     
  21. TheDavid8

    TheDavid8

    Joined:
    Nov 19, 2013
    Posts:
    52
    I'm desperately trying to find a fix for this as well. What's strange is that it was working fine and suddenly started outputting choppy video you can see on my twitter @david_ruttan the video quality was fine up up until I took a month break and now the videos seem to have very low bit rate despite being on high quality. Does the newest alpha build address recorder issues?
     
  22. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    a436t4ataf likes this.
  23. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    "Recorder 4.0.0-pre.3 is only compatible with Unity versions 2022.1 and onwards"

    i.e. it is unavailable for any current version of Unity - it's alpha only :(.

    We can't even test that. If you launched it in a Unity beta (e.g. 2021) - we still couldn't test it on real projects, but we could at least look at it. (2020.3.26 is the latest production build of Unity).

    Is this the plan? No useable version of Recorder for another 2 years?

    Or are you going to release a Unity-compatible version later? One that we can all start testing and logging bugs etc on?
     
  24. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    The feature depends on changes that are only available in Unity 2022, so it is not possible to implement it in 2020.X. Regards
     
    Last edited: Jan 20, 2022
  25. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    Please understand that this functionality relies on other changes inside unity, that are impossible to be backported to earlier versions.
     
  26. Zillus

    Zillus

    Joined:
    May 31, 2017
    Posts:
    24
    Thank you so much for making custom encoding options available, it should save me a lot of time. However, I have noticed something that is probably (hopefully?) a bug. If you record on H264 High option, you get an audio bitrate of 194kb/s, but if you choose any custom settings, the audio appears to default all the way down to 96kb/s (the audio you get with the "Low" preset) - which unfortunately makes it virtually useless. Youtube recommends 384kb/s for stereo, for example - four times what the Recorder gives you.

    Really it would be great if we could choose custom audio spec, or at least a quality slider or something. 194 is already much lower than it should be, 96 is just not viable. Thanks!
     
  27. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    Thank you for finding this issue, we hadn't noticed it. Short term, we are going to address this by giving Custom quality recordings the highest quality feasible with our encoder (192 kbps). Giving you a better control of the audio bitrate is something on our radar but we can't estimate when this will be available.

    Note that this limitation is only there for the H.264 MP4 and VP8 WebM encoders. The ProRes encoder uses 16-bit PCM WAV and does not encode the audio like the aforementioned encoders do.
     
  28. Zillus

    Zillus

    Joined:
    May 31, 2017
    Posts:
    24
    My use is very niche so I am sure most users wouldn't mind. I am recording multiple hours of 4k@60fps - even Proxy ProRes results in truly gigantic files and needs to be rerendered for streaming. Ideally I'd love a ready-to-upload file straight out of the recorder. For now I am exporting H264 and a separate wav and then stitching them together without rerendering with FFmpeg.

    I tried VP8 but the quality did not look as good as H264 to my eye, colours shifted quite a bit frame-to-frame.

    Thanks for all the hard work!
     
  29. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    Thank you for the kind words.

    If you are willing to try an alpha build, I suggest using getting 2022.1 and Recorder 4.0.0-pre.3.
    In 4.0.0-pre.3 (not compatible with Unity before 2022.1) we introduced a new "Custom" quality that allows you to set your own bitrate. There's an issue where custom video bitrate forces low quality audio (64 kbps), we are working on fixing this, but otherwise you should be able to control quality well.

    get 2022.1: https://unity3d.com/beta/2022.1a
    release notes: https://docs.unity3d.com/Packages/com.unity.recorder@4.0/changelog/CHANGELOG.html
    how to install: https://forum.unity.com/threads/recorder-release-announcements.1071971/#post-7826976
     
  30. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,054
    I tried out the 4.0.0 recorder in 2022.1 and from my few tests it looks like using custom values for mp4 settings is working well. Having looked into the best settings for quality mp4 I'm kind of shocked it was ever released with high set to a messily 8 Mbps in the first place as its totally unsuitable for anything with motion.

    However I'm unable to use it as there is no way i'm updating or even trying to branch off the project into such a beta version of Unity, so i'm stuck rendering to Prores LT ( as Proxy still generated huge files but with artefacts ).

    I really don't understand what change was needed to require the latest beta of Unity to support entering custom bitrates for mp4 and very disappointed to hear it wont/can't be backported. Its making me seriously consider just ditching Unity Recorder for video and rolling my own using say Natcorder as a basis. Is there really no way this type of functionality can't be added to at least 2021?
     
    a436t4ataf likes this.
  31. unitybru

    unitybru

    Unity Technologies

    Joined:
    Jan 28, 2020
    Posts:
    225
    The Unity Core encoder for H.264 and VP8 relies on the Unity Core code, and that underlying code is not owned by the Recorder team. Support for custom quality was added in the alpha version of Editor and will not be backported. As such, we cannot add support for this in older versions of the Editor. We understand your frustration, but we have to invest our energy in building tools for the future. We will keep fixing bugs in older supported versions of the package, but new features are almost never backported.
     
    Zillus likes this.