Question / Help Local recording not using stream encoder during "automatically record"

TigerhawkT3

New Member
I've been using the new General setting "Automatically record while streaming," but it looks like it's not actually using the stream encoder (which I do have checked). I have my stream encoder set up for VBR, and I can confirm that that setting is used while streaming. When I just make a local recording, that setting is used also, with high-motion recordings having a higher average bitrate than low-motion recordings.

However, when I inspect the recordings produced during a stream with the new option, they are CBR, with the precise bitrate that appears in the encoding options (which happens to be meaningless when VBR is selected, as it's the CRF setting that controls quality for VBR encoding). Why isn't it recording exactly what gets streamed? Is it silently doing two separate encodings (requiring more CPU)? If I tell it to use a specific encoder for recording and set it up to exactly match the streaming encoder, will that cause two separate encodings? The whole reason I never tried to hit "Start Streaming" and then immediately "Start Recording" is because I figured it would naively perform two separate encodings, so I was waiting for this option, think it would simply write the streamed data to a file, but it looks like it's not doing that.

Some streams end up with a higher average bitrate than the supposedly meaningless value I have selected, so those recordings must logically have lower quality than the streamed video during those high-motion segments. What's going on with this "Automatically record while streaming" option, and how do I make it obey the "(Use stream encoder)" recording setting?
 

Sapiens

Forum Moderator
The bitrate value will still limit the max bitrate of the recording when using VBR. If the CRF value sets a quality target higher than the encoder can achieve within the bitrate constraints it will more or less just use the max bitrate during that time. The option to enforce stream provider requirements will also cap the bitrate at an appropriate value, e.g. 3500 Kbps for Twitch.

Why are you streaming in VBR? Don't do that. If you want to make a higher quality local recording then use the recording quality presets in simple output mode, or set up proper recording settings in advanced output mode.
 

TigerhawkT3

New Member
If the bitrate value becomes a cap when recording in VBR, I would expect the average video bitrate to be lower than that value. Instead, I've been seeing average video bitrate values that exactly match that bitrate value, even for content that I know has some low-motion segments. While the bitrate was at 2000, I have two recordings (taken while simultaneously streaming, with the new option) where the video bitrate is exactly 2000. I changed it to 2016 for my next stream, and, sure enough, that recording has an average video bitrate of exactly 2016.

That said, I just finished another stream after toggling some OBS settings back and forth a few times (ending up with unchanged settings), and the resulting recording has an average video bitrate of 1896, while the bitrate option was still at 2016. I don't know why it's becoming different now.

As far as streaming in VBR, I've read in streaming guides that it causes buffering for viewers. However, although I've occasionally seen YouTube's live dashboard complain about low output, viewers always say there's no problem, and the resulting archive has no discernible issues, so I've kept going with it. Is there some other issue I should be looking out for?
 

TigerhawkT3

New Member
I set the video bitrate in OBS to 4000 with VBR still active to ensure that the max bitrate is high enough for high-motion segments, streamed with automatic local recording, and it created a video file with an average video bitrate of exactly 4000... 1.07GB for 35.5 minutes. YouTube's "stream health" pane showed a constant flow of messages about the bitrate being higher than the recommended value of 2500. It wasn't a high-motion stream, so I strongly suspect that the setting for automatic local recording is overriding my chosen video preferences with some other arbitrary settings.

As I don't know what other settings it might be silently ignoring, I won't be using this feature until it is reliable.
 

Sapiens

Forum Moderator
Why are you streaming in VBR? Stop streaming in VBR. You can stream and record with different settings, so if you want a high quality local recording you can set it up that way (or even better with CRF and no bitrate limit), but your stream should be using CBR.
 

TigerhawkT3

New Member
I gave it another try, and found that the local recordings are somehow alternating between following my settings and ignoring them. I set the bitrate "limit" to 4000 and got a stream recording with an average video bitrate of 1896. The next is exactly 4000. After that, I set it to 3000 and got a recording with an average of 2837. The next, exactly 3000. I watch the bitrate output as I'm streaming, and it does constantly change, as it properly should with VBR. I don't understand why the recordings are different.

I do use different scenes each time, but as far as I know that doesn't affect settings like this (although I wish it could; it would be nice to be able to choose specific settings for certain scenes). What in the world is making it do this?

I am not currently interested in the streaming benefits of CBR vs VBR. I would just like to know why the settings I'm choosing are getting ignored half the time.
 

Suslik V

Active Member
Post your logs, please. From all this attempts where you think 4000, 3000, or whatever else number is doing wrong for the recording and the streaming.
 

Sapiens

Forum Moderator
Most these have no streaming/recording attempts. The ones that do show that CBR is enabled but the buffer size is set to 0, which is more or less a failed local recording configuration. Presumably you have the "Enforce streaming service encoder settings" box checked under Settings > Output which will override some of your settings, like the rate control method.

You should also update to 0.15.4, and consider breaking out that insane pile of scenes and sources into separate scene collections.
 

TigerhawkT3

New Member
I do have "Enforce streaming service encoder settings" turned on. I did some Googling but couldn't find where those are listed - I'm not even sure whether they're some locally-stored OBS setting or some information that's dynamically sent to OBS whenever it starts a stream. Where can I find out exactly what those settings are?

I had set the buffer to 0 because that was in the instructions of how to use VBR: select VBR, set buffer to 0, ignore bitrate, set quality with CRF.

I've been watching the bitrate output when I stream (still with VBR, as I'd like to resolve this mystery), and it does vary, from under 1Mbps to over 3Mbps (I have it set at 3Mbps). The "stream health" analytics for today's stream confirm this, as sometimes it complains about not enough video at e.g. 751kbps and other times it complains about too much at e.g. 5134kbps. However, the resulting local recording has an average bitrate of exactly 3Mbps.

Could it simply be instabilities in my upload speed, making a constant 3Mbps video feed sometimes upload at <1Mbps and other times at nearly 10Mbps? But if that's the case, why is the recording sometimes VBR? I have one here at an average video bitrate of 2036kbps (when the "cap" was set to 2000) and another at 2837kbps (when the "cap" was 4000).
 

TigerhawkT3

New Member
That makes sense. Is there anywhere I can find out what those settings are? Is it a local definition in OBS, or retrieved from the selected service provider, or what?

I briefly thought that maybe the local recordings with average bitrates that don't match what was selected in the settings were due to dropped frames, but one of them has a higher bitrate than the average, so that doesn't explain it. :(

If I uncheck the "enforce streaming service encoder settings" option, will that stream with the exact settings I specify, and produce a local recording that's just an exact copy of whatever data were streamed?
 

Sapiens

Forum Moderator
Service setting restrictions are stored in the services.json file in your OBS Studio installation directory. Twitch's restrictions are:

Code:
"recommended": {
  "keyint": 2,
  "profile": "main",
  "max video bitrate": 3500,
  "max audio bitrate": 160,
  "x264opts": "scenecut=0"
}

I would like to reiterate once again that streaming with VBR is not appropriate, and furthermore than the custom settings you are attempting to use from the local recording guide (local recording guide!) are particularly inappropriate for streaming as they remove all bitrate limitations from the encoder. You are driving me slightly insane with your attempts to use the worst possible streaming settings and ignoring all advice to the contrary.
 

TigerhawkT3

New Member
Sorry about that. I'll switch to CBR. I'm just trying to figure out why, when I have VBR selected and simultaneous local recording turned on, the local recording is sometimes CBR and other times VBR, while the encoder readout and YouTube's stream health analytics show a fluctuating bitrate.

I inspected the JSON file (thank you for the link to that - I couldn't figure out where to find it) and found that YouTube's encoder recommendations specify servers, keyframe interval (which OBS sometimes doesn't adhere to, as I occasionally see the stream health analytics complain about infrequent keyframes), and maximum bitrates for video (16Mbps) and audio (160kbps). I was hoping that one of the recommended settings would be CBR, to explain what's happening to create CBR local recordings when I have VBR set, but there's no smoking gun.

I'll change the settings to CBR. With any luck, I'll at least see consistency between YouTube's stream health analytics, OBS's real-time bitrate readout, and local recordings. I would've liked to solve this mystery, but I'll settle for predictable behavior.
 

TigerhawkT3

New Member
I currently have no idea whether the bitrate in VBR mode acts as a cap or removes all limitations. I currently have no idea whether the service settings restrictions were turning my VBR settings into CBR. I currently have no idea whether those restrictions are intended to do that (they only mention ingest servers and bitrate caps). And, finally, I currently have no idea why some VBR streams with local recordings would produce a local recording with an average bitrate of the exact listed value, while others produced local recordings with apparently an actual variable bitrate.

I'm more confused now than I was before I started this thread.
 
Top