Unity Recorder Output Format Wars

Back in 2021 there was a forum thread on video quality for the MP4 recorder. A few people reported getting poor quality MP4 files recorded, myself included. I have since upgraded from 2021.2 to 2022.2 (with a newer version of the Recorder) so was curious to see how much better the results were.

First, a blast from the past. Here is what the Recorder captured for a frame in one of my videos (from the above thread). And yes, I hand picked the worse frame I could from the video – it was not all this bad. WebM was much better quality so I used that instead.

I have changed the project a bit since then, so it is not exactly the same shot, but here is a screenshot from the MP4 Recorder 4.0.0 in Unity 2022.2. Soooo much better!

As well as improving the quality, there are now more choices for the output file format.

  • MP4
  • WebM
  • ProRes (lots of variants)
  • ffmpeg for MP4 (lots of variants)

I must admit to liking MP4 as most video tools support it. So I zoomed in on the front of the bus for the same frame of the video generated using different recorder settings to see if I could see any differences in the detail.

Looking closely at the red ovals on the first video and comparing them to the other variations tested (you may need to zoom in on the image – Control-Plus will zoom in on most web browsers):

  • The leftmost oval shows the texture in front of the bus in MP4 is somewhat blurred compared to the other videos.
  • The second oval shows it is not easy to see through the front windscreen of the bus (blurred) in the first video.
  • The bus driver’s face in the first video is badly blurred.
  • The wall panel (right) is not the same as the other shots.
  • There is some noise near the boy’s shoulder not present in the other formats.

While this is a single test, it does indicate:

  • Unity has HUGELY improved the built in MP4 recorder.
  • ffmpeg is generating better quality MP4 files than the built in Unity Recorder MP4 encoder.
  • MP4 can have good quality video files – it is something about the Unity Recorder encoding software, not the file format, that is the issue.

One thing I observed when using the Unity MP4 recorder, Unity does not slow down when writing out the file. Using WebM on the other hand noticeably slowed down playback. I was wondering if the Unity MP4 recorder was attempting to keep things real time by lowering the encoding quality to meet time deadlines for the next frame (someone from Unity said they did not believe this was the case). WebM on the other hand says “the world can wait for me” – playback rate noticeably declines when using WebM, but the video quality is better. (Note that the Unity MP4 and WebM code paths are apparently quite similar internally, especially when compared to the other output formats.)

Another question is what are the file sizes, which is typically influenced by the encoding compression rate. I just used default configuration settings. Here are the output file sizes for the above 5 cases.

      Unity MP4:        5.4 mb
      Unity WebM:      26.4 mb
      Unity ProRes:   255.5 mb
      ffmpeg default:  14.6 mb
      ffmpeg NVIDIA:    6.8 mb

Squinting at the zoomed in image, I could well believe the ProRes is the best quality – given the difference in file size I assume there is no compression. But it’s 10 times bigger as a result! Using ffmpeg NVIDIA I noticed the MP4 file is almost 3 times smaller than ffmpeg default, close to the Unity MP4 file. The NVIDIA file is a little lower quality (e.g., look at the face of the bus driver – it’s a little worse), but it’s much better than the Unity built in MP4 recorder. So Unity MP4 being worse quality is not only because a higher compression factor is being used.

Conclusion? I am leaning towards using ffmpeg, but might try a few more tests before deciding between file size and video quality. But in all cases the quality for this test is much improved, and I no longer need to use an external WebM to MP4 converter to create MP4 files.

Postscript – enabling ffmpeg

If you want to give ffmpeg a go with Recorder 4.0.0, you need to go to the package manager and install “Customer Encoder: FFmpeg” under “Samples”.

You also need to install the ffmpeg binary and give Unity the path name to the ffmpeg executable in the recorder clip settings. The following shows the FFmpeg Path setting and a list of choices of which encoder to use. I have only tried the first two choices so far.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s