Recording high quality videos with Open Broadcaster Software
A screenshot from the Unity project I was testing with, which funnily enough was the worst possible scenario for video compression.
January 2, 2016 | 10 comments

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:
https://obsproject.com

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:

OBS encoding settings
The important settings are:
Use CBR: Disabled
Use Custom Buffer Size: Enabled
Buffer Size (kbit): 0

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:
https://jp9000.github.io/OBS/settings/encodingsettings.html

Lastly, my advanced settings:

OBS advanced settings
There's only one important setting here:
Custom x264 Encoder Settings: Enabled
And in the Custom x264 Encoder Settings field type "crf=20"

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:
https://jp9000.github.io/OBS/settings/advancedsettings.html

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:

OBS log window
The log files give you information about your previous recordings like CPU usage, dropped, late and duplicated frames and more. It's very useful for debugging problems with your recordings.

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:
https://www.youtube.com/watch?v=BAinWM-GYNQ

And here's a short gameplay recording of Rampage Knights (my game of the year for 2015 btw) showcasing more ideal recording conditions:
https://www.youtube.com/watch?v=CJLtV_flqIo

BONUS: Making GIFs (that are not actually GIFs)

To create GIFs (that are not actually GIFs) I use gfycat:
https://gfycat.com/

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:
https://gfycat.com/PartialUnnaturalIndianpalmsquirrel

Then the GIF:
https://giant.gfycat.com/PartialUnnaturalIndianpalmsquirrel.gif

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:
https://gfycat.com/MindlessBraveAplomadofalcon

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:
http://www.cockos.com/licecap

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.

Conclusion

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.

Additional links

Here's an article describing what CRF or constant rate factor is:
http://slhck.info/articles/crf

The official Open Broadcaster Software help files:
http://jp9000.github.io/OBS

Get the Unity test project here:
http://twiik.net/projects/gems

Øyvind Strømsvik's picture

About Øyvind Strømsvik (TwiiK)

I've been passionate about games all my life and started dabbling in game development about 15 years ago with BlitzBasic,... read more but I quickly lost interest and began doing 3d modeling instead. 3d modeling remained a hobby and I picked up game development again around the release of Unity 2.0. My driving force behind wanting to get back into game development was my lost interest in commercial games as they started appealing to a group of gamers I was no longer in. Indie games were the only games that still looked interesting, but at the same time some of them looked like they would be just as fun to make as to actually play. And many of them were made by just one guy.

JorgeHFJ's picture

JorgeHFJ

I was trying to set the OBS for a long time! Lots of useless info about it on the web, but yours worked perfectly! Thank you very much!!

Øyvind Strømsvik's picture

Øyvind Strømsvik

@JorgeHFJ: Thank you for the nice comment! :)

Joaquin25022001's picture

Joaquin25022001

What?! One comment?! What about mine? Okay, let me say something: This gives me 1080p video with FPS between 54-60. And one more thing! It is recommended that the outputted file is in .flv. As if the computer crashes or OBS crashes while the output file is in .mp4 format, the whole .mp4 is useless. .flv won't do that. You can always convert .flv to .mp4.

Øyvind Strømsvik's picture

Øyvind Strømsvik

@Joaquin25022001: What do you mean by "One comment"? :) I've been reworking the comments lately and I just removed an automatic spam filter that I think blocked everyone's comments for months, which obviously wasn't what I had in mind when I installed it.

Is the comment number wrong? I have a todo that there's something fishy going on with my caching as well so it may display the incorrect comments or comment number when viewing the site, but I haven't gotten around to investigating that yet.

There are 4 comments for this post at the moment, including this one. :)

As for your comment if FLV works better for you then that's great, but I prefer MP4 as it's easier to play, is not proprietary, is more widely supported, and I don't have to convert anything. I can understand the "crash support" being a worthwhile feature if you're streaming or something like that, but I only use OBS for recording short gameplay segments or to show off whatever I'm working on and if anything crashes while I'm recording I want to record the entire thing again anyway. :)

The framerate you get depend on your system and how taxed your computer is while you're recording. Like I said I haven't tried recording anything that's taxing on my system with these settings and it probably wouldn't work so well as my system is fairly old and I need quite a bit of free resources just to run OBS smoothly. In general you would need a separate computer or video capture card to ensure smooth video recording independent of what you're recording.

Edit: And there seems to be an issue when posting comments as well which I just noticed. :/

Joaquin25022001's picture

Joaquin25022001

@Øyvind Strømsvik: Oh, I didn't know that there are other comments at the time I last commented here. Haha, funny, after more than a year I'm back to this page. Actually the whole 1 year I spent is full of experimentations on OBS. And I finally gave up from expimenting the settings by myself, and ended up collecting questions-to-be-asked instead. So the questions (for OBS Classic):

1) I found out the CPU preset in Advanced is like when you are selecting the compression level on creating archives like 7z, zip, or rar. It only affects the size of the output file, so ultrafast does not alter the output quality (graphically) and serves the same as other presets (superfast and lower) except for severely dropped frames (on slowest to medium) because of low-end CPU. Is this true?

2) In Advanced, I noticed there's an option to change Encoding Profile to either Main or High. With your settings, and leaving it to High, the output has the format profile of High@L3.2 (High at level 3.2) and discovered that this level ranges from 1.0 to 5.2. How do these settings affect the output file?

Eden's picture

Eden

Do all these settings work if you have an El Gato HD60? or what should i do different ?

Chris Miller's picture

Chris Miller

Thank you..... This worked. Now able to post 1080p replays of Warthunder...

Niels Henrik's picture

Niels Henrik

Hello.
I've set my settings to the same as yours, but whenever I record locally, I get the warning of high CPU usage in the corner. What do I do to lower the CPU usage?
Also, the preview of the recording, and the video files shows video stuttering.

Cameleon Live's picture

Cameleon Live

Here are the most effective live app, please try on this - https://goo.gl/tzoTLS

lisa's picture

lisa

I always spent my half an hour to read this website’s along with a mug of coffee. Really appreciate this Forum.
http://sli-therio.com

Add new comment