Recording high quality videos with Open Broadcaster Software
Over the past few weeks I've experimented with a lot of different programs for recording videos, but I've had the most luck with Open Broadcaster Software (OBS) so that's the program this article is about. It's also completely free and, in my opinion, by far the most intuitive, flexible and feature rich program out there.
This article servers to document my ongoing efforts in trying to get good quality video recordings of my Unity projects. I've spent so much time on this now, and in the process managed to get the quality of my recorded videos from absolutely horrible to pretty good, that I guess other people will also be interested in what I've discovered.
I wasn't going to write an article about this, my initial goal was just to see if it was possible to record 1080p60fps video for Youtube without a dedicated video capture card, but that ended up taking me weeks of tweaking and experimenting and I ended up learning a lot along the way, information that may be of interest to other people out there.
I won't go into detail about what OBS is or how to use it, in fact I won't write about it at all, I assume you've learned that someplace else, I'll just focus on the settings needed to ensure the highest possible quality videos for Youtube, but these settings can be used for anything, you can even get lossless video you can import into video editing software using these settings if you wish. My primary goal was 1080p60fps video that looks crisp and smooth on Youtube.
First of all, if you haven't already, you can download OBS from their website, here:
And like I said if you're just now downloading OBS you should probably familiarize yourself a bit with the software before continuing with the article. This article is intended for those who have tried recording a bunch of videos, but are unhappy with the quality they're getting.
I'm using the dedicated Windows version. I will continue doing that until they phase it out and only offer the multi-platform version. I have tried the multi-platform version and I think you can already do the same things in the multi-platform version, but the interface is very different and I'm not able to get things the way I want them, which is why I'm sticking with the Windows only version for the time being.
So without further ado, here are the settings i use in OBS. Firstly, my encoding settings:
CBR stands for constant bitrate, we don't want that, we want our bitrate to be variable ensuring we have as much bitrate as we need to achieve the highest possible quality video recording. This is also good because the bitrate will never be higher than it needs to be, so if you're recording something where there's not a whole lot of movement on screen your bitrate will be low without it affecting the quality of the video.
Buffer Size is for streaming, I think. This is the only setting I'm not entirely sure about. Someone told me to set it to 0 and I've had it at 0 every since. I think 0 disables the buffer which is probably what we want when we're recording video and not streaming.
Quality Balance and Max Bitrate are not used, we specify a custom parameter in the Advanced tab which override these two settings. That's why I've entered 0 and 999999, just to remind me they are not used. I could set Max Bitrate to 0, but it defaults to 64, which is confusing so I set it to an obviously ridiculous number.
For audio I set the Format to 48kHz and Bitrate to 192. I'm not sure about these two, but I've read that this is ideal for Youtube which is what I'm aiming for. If your goal is to edit the videos in video editing software you can set these values to whatever you need.
You can read more about what each setting does in the official OBS help files, here:
Lastly, my advanced settings:
Putting "crf=20" in the Custom x264 Encoder Settings field tells the encoder you want a constant rate factor of 20. You can put anything you want instead of 20, but this value single-handedly determines the bitrate and thus the quality of your recording. This is because we've already disabled all the other means of controlling quality in the encoding settings. Quality Balance in the encoding settings actually does the exact same thing, but for some reason it doesn't go high enough. Even when you set Quality Balance to 10 it's not as high as "crf=20". Honestly, I don't exactly understand what CRF is, but I think it's an encoding method used by the x264 encoder, and I know that the lower the value is the higher the video bitrate can go and thus the video quality. A Quality Balance of 10 equals CRF 22 and a Quality Balance of 0 equals CRF 32. We want lower values than that, for comparison a CRF of 0 is lossless, but this is often impractical in terms of filesize. You can try it out and see for yourself, it may be what you're after if your goal is to edit the video in a video editing software rather than upload it directly to Youtube. I experimented with values between 15 and 20 here and found 20 to be a good number for 1080p60fps videos for Youtube. I've linked an article going in depth about what CRF is at the bottom of this article if you're extra curious.
Although the Custom x264 Encoder Settings is the only important setting in this tab there are other settings you should experiment with. First of all x264 CPU Preset determines the CPU usage of OBS. You'd think this was a no-brainer because obviously you want your recording software to use as little CPU as possible, but according to the documentation higher CPU usage means higher quality and lower CPU usage means lower quality. But I can't personally see any difference in that regard which is why I've set it to ultrafast. That ensures OBS uses as little CPU as possible, the default setting is veryfast. The difference between these two is pretty substantial. 5-10% CPU usage on ultrafast vs 30-40% CPU usage on veryfast for my system. The documentation recommends that you never set this lower than veryfast, but like me you can probably just set it to ultrafast unless you notice a quality loss.
The other setting you should experiment with is Use CFR. CFR stands for constant frame rate. Setting this to true forces OBS to output at a constant frame rate, duplicating frames if necessary to achieve this. The documentation recommends that this setting is turned off unless your goal is to import the video into video editing software, but oddly enough it is turned on by default. I tried with it both on and off and I felt like the video was smoother with it off.
Again, you can read more about what each setting does on in official OBS help files:
These are the most important settings to ensure the best possible video recordings from OBS, but you should also familiarize yourself with all the other settings. Under "Broadcast settings" you determine where you want your videos to be saved. I was told that to ensure optimal video quality I should save the recorded video to a separate hard drive from the one that was running the application I was recording and that this hard drive should be a SSD, but in my testing this didn't actually make a difference, so I guess hard drive write speed is not a bottleneck when working with 1080p60fps video. Howver, it may be if you're working with higher resolutions, higher frame rates or closer to lossless quality so you can experiment with this if you're having issues.
You should also familiarize yourself with the log files and log window. The log files show you a lot of helpful information about your recordings. You find it here:
Lastly, here are two example videos made with these settings. First out is the video I was initially testing with, which as it turns out is pretty much the worst possible scenario for video compression:
And here's a short gameplay recording of Rampage Knights (my game of the year for 2015 btw) showcasing more ideal recording conditions:
BONUS: Making GIFs (that are not actually GIFs)
To create GIFs (that are not actually GIFs) I use gfycat:
The reason I'm saying they are not actually GIFs is because a lot of people think they are GIFs and refer to them as GIFs, but gfycat is HTML 5 video. They encode your video into a lot of different video formats suited for web (different browsers support different formats) and then present the best suited video format for your browser in a HTML 5 video player which is just as intuitive as a GIF, but offers a number of benefits such as greatly reduced file sizes, better quality, controls for play/pause/rewind etc.
Gfycat is also amazingly easy to use. It's completely free to use and you do not need an account to use it. Creating an account can be smart though just to keep track of your GIFs (that are not actually GIFs). To use gfycat you can quite simply just paste a Youtube video url into the upload field and it will let you select a 15 second section from the video. That is the only real limitation with gfycat - your clips can't be longer than 15 seconds. This is acceptable in my opinion, this is just for short clips showcasing what you're currently working on, use Youtube for anything longer and more involved. You can also upload videos recorded with OBS directly to gfycat, but then you must ensure the video is less than 15 seconds long because you will not be able to select a portion of it like you can when you're converting a Youtube video.
Gfycat makes a point of showing you just how much smaller their HTML 5 video is compared to an equal GIF (They always give you a GIF of your video if you want to use that instead, but I can't see why you ever would). Here's an example video I recorded from Rampage Knights.
First the HTML 5 video:
According to gfycat the GIF is 30.9MB and the the HTML 5 video is 28.1 times smaller at just 1.1MB. These clips were made by converting a video from Youtube. Apparently the resulting clips won't be higher than 720p and 30fps when you're converting a Youtube video, but if you're uploading a video directly from your computer to gfycat then you can make 1080p60fps clips.
Here's an example of a 1080p60fps clip:
BONUS 2: Making actual GIFs
I completely forgot about a small, but completely awesome application I use for recording actual GIFs so I thought I would edit this article and mention it. The application is called LICEcap, and you can read more about it and download it from here:
LICEcap is pretty much the most intuitive application I've ever used. I use it all the time at work for recording tiny screencasts for clients and I just realized it's great for recording Unity content as well. When you launch LICEcap you get a frame that you can resize and place over anything you want to record. Then you just supply a framerate and say where you want to save the GIF and hit record. Anything within the frame is recorded. It couldn't be simpler.
You can also upload these GIFs to gfycat to convert them to HTML5 video.
That is all. Hopefully this will enable you to record both Youtube videos and gfycat gifs (videos) in crisp and smooth 1080p60fps of anything you're working on in Unity, or anywhere else for that matter. If you have any questions or suggestions please let me know in the comments below.
There is one thing I still haven't figured out. The videos I get from Open Broadcaster Software (or any recording software for that matter) are ever so slightly desaturated compared to the source material. I don't know why or how to solve this. It may be an Nvidia issue or it may be an issue with my computer, or it may of course be an issue with the recording software. I've compared my videos to other videos on Youtube of the exact same source material and other people don't have this problem, but I'm sure a lot of Youtubers use dedicated video capture cards which probably make the comparison unfair. I'll update the article if I ever figure this one out.
Here's an article describing what CRF or constant rate factor is:
The official Open Broadcaster Software help files:
Get the Unity test project here: