Question / Help Bitrate being dropped by OBS

devster

New Member
Hello,
I'm having the following issue on macOS while streaming, here the log file -> https://obsproject.com/logs/Tz0aZxcwTCajva03
The stream bitrate drops heavily and I'm unable to figure out why.
Capture card is an Elgato HD60 S+ which had no issues on the video side since recently.
My connection should be plenty fast to stream at 6000 kbps and the pc should be fast enough to render at faster preset for 6000 kbps:
 

Narcogen

Active Member
Speedtest results are not relevant to streaming. What results do the Restream bandwidth test give you?

If you turn off dynamic bitrate, do frames drop? Is your connection speed actually dropping, or is dynamic bitrate dropping it unnecessarily?
 

devster

New Member
Speedtest results are not relevant to streaming. What results do the Restream bandwidth test give you?
Apologies, tests show a sharp rise and an average betwen 15 and 30 Mbps.
If you turn off dynamic bitrate, do frames drop? Is your connection speed actually dropping, or is dynamic bitrate dropping it unnecessarily?
I'm using Output Mode: Simple, I can't seem to find dynamic bitrate option there.
Should I switch to Advanced and use CBR or other rate control methods?

Could this issue be caused by a defective capture card or cable?
 

Narcogen

Active Member
No, that's a network issue. If a cable is related, it's a network cable.

I didn't think dynamic bitrate was on by default. I'd go to advanced mode and try turning it off.
 

devster

New Member
Ok, tried changing to CBR, but that gives me high encoding lag even at very low bitrates (2k), and I wouldn't expect it given the hardware.
I moved to VBR at 6k and 21 CRF, issue remains in both cases.
However, if it's a network issue I can check router/switch, maybe something there?
This is what restream sees:
Screen-Shot-2020-04-05-22-30-40.90.png
 
Last edited:

Narcogen

Active Member
Just for the sake of clarity... dynamic bitrate and VBR (variable bitrate) are not really the same.

Most streaming platforms want constant bitrate. Dynamic bitrate changes the static bitrate used dynamically based on available bandwith. Once it sets that bitrate, though, it sends .... about that amount... for all the content it encodes.

Rate controls like VBR, CQP/CRF use more or less data based on the content of the frames being encoded, not based on available bitrate. This is most appropriate for local recording, and not for live streaming.

If you're getting frames dropped for insufficient network when using CBR, then yes, start looking at firewalls, antivirus, your network card drivers, your local cabling, your router configuration, and then your ISP. None of these issues have to do with your CPU, your GPU or your capture card. Those are flagged as rendering lag or encoding lag

Dropped Frames/Connection Issues
 

devster

New Member
I'm not seeing frames dropped because of network, OBS is reducing the bitrate on its own.
This is a snippet of the issue (albeit with dynamic bitrate, haven't tested with CBR):
Code:
18:19:33.698: [rtmp stream: 'simple_stream'] Connection to rtmp://live.restream.io/live successful
18:19:33.701: ==== Streaming Start ===============================================
18:27:30.170: [rtmp stream: 'simple_stream'] bitrate decreased to: 5600
18:27:31.588: [rtmp stream: 'simple_stream'] bitrate decreased to: 1100
18:27:44.914: [rtmp stream: 'simple_stream'] bitrate decreased to: 1000
18:27:45.782: [rtmp stream: 'simple_stream'] bitrate decreased to: 200
18:27:46.814: [rtmp stream: 'simple_stream'] bitrate decreased to: 50
18:27:47.469: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29577, -3623 bits)
18:27:47.469:
18:27:47.530: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29581, -7331 bits)
18:27:47.530:
18:27:47.546: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29582, -295 bits)
18:27:47.546:
18:27:47.564: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29583, -383 bits)
18:27:47.564:
18:27:47.597: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29585, -7885 bits)
18:27:47.597:
18:27:47.614: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29586, -503 bits)
18:27:47.614:
18:27:47.630: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29587, -207 bits)
18:27:47.630:
18:27:47.664: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29589, -7237 bits)
18:27:47.664:
18:27:47.682: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29590, -623 bits)
18:27:47.682:
18:27:47.697: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29591, -199 bits)
18:27:47.697:
18:27:47.714: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29592, -431 bits)
18:27:47.714:
18:27:47.730: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29593, -8319 bits)
18:27:47.730:
18:27:47.764: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29595, -6957 bits)
18:27:47.764:
18:27:47.781: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29596, -463 bits)
18:27:47.781:
18:27:47.817: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29598, -381 bits)
18:27:47.817:
18:27:47.829: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29599, -5503 bits)
18:27:47.829:
18:27:47.849: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29600, -127 bits)
18:27:47.849:
18:27:47.864: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29601, -3895 bits)
18:27:47.864:
18:27:51.131: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29797, -6811 bits)
18:27:51.131:
18:27:51.148: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29798, -6903 bits)
18:27:51.148:
18:27:51.165: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29799, -4463 bits)
18:27:51.165:
18:27:51.180: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29800, -5519 bits)
18:27:51.180:
18:27:51.197: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29801, -4415 bits)
18:27:51.197:
18:27:51.214: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29802, -3631 bits)
18:27:51.214:
18:27:51.231: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29803, -3223 bits)
18:27:51.231:
18:27:51.248: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29804, -2287 bits)
18:27:51.248:
18:27:51.264: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29805, -2639 bits)
18:27:51.264:
18:27:51.280: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29806, -2207 bits)
18:27:51.280:
18:27:51.298: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29807, -2375 bits)
18:27:51.298:
18:27:51.314: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29808, -1463 bits)
18:27:51.314:
18:27:51.331: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 29809, -3359 bits)
18:27:51.331:
18:28:16.832: Last log entry repeated for 158 more lines
18:28:16.832: [rtmp stream: 'simple_stream'] bitrate increased to: 650, waiting
18:28:46.850: [rtmp stream: 'simple_stream'] bitrate increased to: 1250, waiting
18:29:11.698: [rtmp stream: 'simple_stream'] going back to prev bitrate
18:29:11.698: [rtmp stream: 'simple_stream'] bitrate decreased to: 650
18:29:25.513: [rtmp stream: 'simple_stream'] bitrate decreased to: 600
18:29:26.532: [rtmp stream: 'simple_stream'] bitrate decreased to: 400
18:29:56.533: [rtmp stream: 'simple_stream'] bitrate increased to: 1000, waiting
18:30:12.500: [rtmp stream: 'simple_stream'] bitrate decreased to: 900
18:30:13.833: [rtmp stream: 'simple_stream'] bitrate decreased to: 100
18:30:14.599: [x264 encoder: 'simple_h264_stream'] VBV underflow (frame 38405, -10212 bits)
and this with CBR:
Code:
21:06:28.813: Settings changed (outputs)
21:06:28.813: ------------------------------------------------
21:24:50.294: User switched to scene 'Intro'
21:25:17.201: ---------------------------------
21:25:17.201: [x264 encoder: 'streaming_h264'] preset: fast
21:25:17.201: [x264 encoder: 'streaming_h264'] profile: main
21:25:17.201: [x264 encoder: 'streaming_h264'] tune: zerolatency
21:25:17.201: [x264 encoder: 'streaming_h264'] settings:
21:25:17.201:     rate_control: CBR
21:25:17.201:     bitrate:      6000
21:25:17.201:     buffer size:  6000
21:25:17.201:     crf:          0
21:25:17.201:     fps_num:      60
21:25:17.201:     fps_den:      1
21:25:17.201:     width:        1920
21:25:17.201:     height:       1080
21:25:17.201:     keyint:       120
21:25:17.201: 
21:25:17.208: [CoreAudio AAC: 'avc_aac_stream']: settings:
21:25:17.208:     mode:          AAC
21:25:17.208:     bitrate:       160
21:25:17.208:     sample rate:   44100
21:25:17.208:     cbr:           on
21:25:17.208:     output buffer: 1536
21:25:17.208: [rtmp stream: 'adv_stream'] Dynamic bitrate enabled.  Dropped frames begone!
21:25:17.208: [rtmp stream: 'adv_stream'] Connecting to RTMP URL rtmp://live.restream.io/live...
21:25:17.626: [rtmp stream: 'adv_stream'] Connection to rtmp://live.restream.io/live successful
21:25:17.628: ==== Streaming Start ===============================================
21:27:50.159: [rtmp stream: 'adv_stream'] bitrate decreased to: 5600
21:27:51.144: [rtmp stream: 'adv_stream'] bitrate decreased to: 4600
21:28:21.149: [rtmp stream: 'adv_stream'] bitrate increased to: 5200, waiting
21:28:51.156: [rtmp stream: 'adv_stream'] bitrate increased to: 5800, waiting
21:29:21.172: [rtmp stream: 'adv_stream'] bitrate increased to: 6000, done
21:31:03.416: Settings changed (outputs)
21:31:03.417: ------------------------------------------------
21:31:25.176: Settings changed (outputs)
21:31:25.176: ------------------------------------------------
21:32:00.644: Settings changed (outputs)
21:32:00.644: ------------------------------------------------
21:33:04.848: User switched to scene 'Game'
21:33:48.413: Settings changed (outputs)
21:33:48.413: ------------------------------------------------
21:34:05.684: [rtmp stream: 'adv_stream'] going back to prev bitrate
21:34:05.684: [rtmp stream: 'adv_stream'] bitrate decreased to: 5800
21:34:05.795: [rtmp stream: 'adv_stream'] bitrate decreased to: 5400
21:34:06.958: [rtmp stream: 'adv_stream'] bitrate decreased to: 700
21:34:07.495: [x264 encoder: 'streaming_h264'] VBV underflow (frame 31789, -1643 bits)
 
Last edited:

devster

New Member
I can't seem to find any obvious culprit, I'm still a bit weirded out by the fact that it's OBS itself lowering the bitrate, even on CBR.
 

Narcogen

Active Member
OBS won't lower the bitrate if CBR is active. It will report dropped frames if the connection fails to meet the required bitrate.

That said.. CBR isn't really constant. It's a constant target.
 

devster

New Member
Ok, but I do not have reported dropped frames due to network connection in the stats panel, so how should I interpret these lines from log:
Code:
02:29:50.833: [rtmp stream: 'adv_stream'] bitrate decreased to: 5500
02:29:52.800: [rtmp stream: 'adv_stream'] bitrate decreased to: 600
02:29:56.601: [x264 encoder: 'streaming_h264'] VBV underflow (frame 2161, -11677 bits)
02:29:56.601: 
02:30:22.811: [rtmp stream: 'adv_stream'] bitrate increased to: 1200, waiting
02:30:31.373: [rtmp stream: 'adv_stream'] going back to prev bitrate
02:30:31.373: [rtmp stream: 'adv_stream'] bitrate decreased to: 600
02:30:35.870: [x264 encoder: 'streaming_h264'] VBV underflow (frame 4517, -3528 bits)
02:30:35.870: 
02:30:52.528: [rtmp stream: 'adv_stream'] bitrate decreased to: 500
02:30:55.900: [rtmp stream: 'adv_stream'] bitrate decreased to: 200
These correspond to the dips I see in the Restream.io graph as well.
They refer to a stream with 0 reported dropped frames for network and the following stats:
Code:
02:29:20.070: [x264 encoder: 'streaming_h264'] preset: veryfast
02:29:20.070: [x264 encoder: 'streaming_h264'] profile: main
02:29:20.070: [x264 encoder: 'streaming_h264'] tune: zerolatency
02:29:20.072: [x264 encoder: 'streaming_h264'] settings:
02:29:20.072:     rate_control: CBR
02:29:20.072:     bitrate:      6000
02:29:20.072:     buffer size:  6000
02:29:20.072:     crf:          0
02:29:20.072:     fps_num:      60
02:29:20.072:     fps_den:      1
02:29:20.072:     width:        1920
02:29:20.072:     height:       1080
02:29:20.072:     keyint:       120
02:29:20.072: 
02:29:20.083: [CoreAudio AAC: 'avc_aac_stream']: settings:
02:29:20.083:     mode:          AAC
02:29:20.083:     bitrate:       160
02:29:20.083:     sample rate:   44100
02:29:20.083:     cbr:           on
02:29:20.083:     output buffer: 1536
[...]
03:04:03.588: [rtmp stream: 'adv_stream'] User stopped the stream
03:04:03.588: Output 'adv_stream': stopping
03:04:03.588: Output 'adv_stream': Total frames output: 124973
03:04:03.588: Output 'adv_stream': Total drawn frames: 124964 (125009 attempted)
03:04:03.588: Output 'adv_stream': Number of lagged frames due to rendering lag/stalls: 45 (0.0%)
03:04:03.589: ==== Streaming Stop ================================================
03:04:07.111: ==== Shutting down ==================================================
03:04:07.115: Switched to scene '(null)'
03:04:07.199: All scene data cleared
03:04:07.199: ------------------------------------------------
03:04:07.273: Freeing OBS context data
03:04:07.286: [Scripting] Total detached callbacks: 0
03:04:07.295: == Profiler Results =============================
03:04:07.295: run_program_init: 1553.27 ms
03:04:07.295:  ┣OBSApp::AppInit: 7.483 ms
03:04:07.295:  ┃ ┗OBSApp::InitLocale: 2.674 ms
03:04:07.295:  ┗OBSApp::OBSInit: 1233.66 ms
03:04:07.295:    ┣obs_startup: 16.379 ms
03:04:07.295:    ┗OBSBasic::OBSInit: 1099.58 ms
03:04:07.295:      ┣OBSBasic::InitBasicConfig: 0.423 ms
03:04:07.295:      ┣OBSBasic::ResetAudio: 0.17 ms
03:04:07.295:      ┣OBSBasic::ResetVideo: 144.645 ms
03:04:07.295:      ┣OBSBasic::InitOBSCallbacks: 0.02 ms
03:04:07.295:      ┣OBSBasic::InitHotkeys: 0.068 ms
03:04:07.295:      ┣obs_load_all_modules: 421.197 ms
03:04:07.295:      ┃ ┣obs_init_module(coreaudio-encoder.so): 0.019 ms
03:04:07.295:      ┃ ┣obs_init_module(decklink-ouput-ui.so): 0.657 ms
03:04:07.295:      ┃ ┣obs_init_module(frontend-tools.so): 4.962 ms
03:04:07.295:      ┃ ┣obs_init_module(image-source.so): 0.009 ms
03:04:07.295:      ┃ ┣obs_init_module(linux-jack.so): 0.004 ms
03:04:07.295:      ┃ ┣obs_init_module(mac-avcapture.so): 86.611 ms
03:04:07.295:      ┃ ┣obs_init_module(mac-capture.so): 0.008 ms
03:04:07.295:      ┃ ┣obs_init_module(mac-decklink.so): 0.085 ms
03:04:07.295:      ┃ ┣obs_init_module(mac-syphon.so): 0.003 ms
03:04:07.295:      ┃ ┣obs_init_module(mac-vth264.so): 101.096 ms
03:04:07.295:      ┃ ┣obs_init_module(obs-browser.so): 0.111 ms
03:04:07.295:      ┃ ┣obs_init_module(obs-ffmpeg.so): 0.025 ms
03:04:07.295:      ┃ ┣obs_init_module(obs-filters.so): 0.015 ms
03:04:07.295:      ┃ ┣obs_init_module(obs-libfdk.so): 0.004 ms
03:04:07.295:      ┃ ┣obs_init_module(obs-outputs.so): 0.006 ms
03:04:07.295:      ┃ ┣obs_init_module(obs-transitions.so): 0.008 ms
03:04:07.295:      ┃ ┣obs_init_module(obs-vst.so): 0.015 ms
03:04:07.295:      ┃ ┣obs_init_module(obs-x264.so): 0.003 ms
03:04:07.295:      ┃ ┣obs_init_module(rtmp-services.so): 1.516 ms
03:04:07.295:      ┃ ┣obs_init_module(text-freetype2.so): 0.016 ms
03:04:07.295:      ┃ ┗obs_init_module(vlc-video.so): 3.495 ms
03:04:07.295:      ┣OBSBasic::ResetOutputs: 18.954 ms
03:04:07.295:      ┣OBSBasic::CreateHotkeys: 0.072 ms
03:04:07.295:      ┣OBSBasic::InitService: 3.149 ms
03:04:07.295:      ┣OBSBasic::InitPrimitives: 0.1 ms
03:04:07.295:      ┗OBSBasic::Load: 448.736 ms
03:04:07.295: obs_hotkey_thread(25 ms): min=0.15 ms, median=0.321 ms, max=2.686 ms, 99th percentile=0.517 ms, 100% below 25 ms
03:04:07.295: audio_thread(Audio): min=0 ms, median=0.28 ms, max=36.399 ms, 99th percentile=4.082 ms
03:04:07.295:  ┗receive_audio: min=0.002 ms, median=0.214 ms, max=2.108 ms, 99th percentile=0.52 ms, 1.06275 calls per parent call
03:04:07.295:    ┣buffer_audio: min=0 ms, median=0.001 ms, max=0.12 ms, 99th percentile=0.003 ms
03:04:07.295:    ┗do_encode: min=0.078 ms, median=0.21 ms, max=2.104 ms, 99th percentile=0.515 ms
03:04:07.295:      ┗encode(avc_aac_stream): min=0.071 ms, median=0.187 ms, max=2.021 ms, 99th percentile=0.485 ms
03:04:07.295: obs_graphics_thread(16.6667 ms): min=0.058 ms, median=1.05 ms, max=373.832 ms, 99th percentile=11.317 ms, 99.6487% below 16.667 ms
03:04:07.295:  ┣tick_sources: min=0 ms, median=0.017 ms, max=361.949 ms, 99th percentile=0.058 ms
03:04:07.295:  ┣output_frame: min=0.016 ms, median=0.727 ms, max=60.214 ms, 99th percentile=8.414 ms
03:04:07.295:  ┃ ┣gs_context(video->graphics): min=0.016 ms, median=0.314 ms, max=59.674 ms, 99th percentile=7.988 ms
03:04:07.295:  ┃ ┃ ┣render_video: min=0.014 ms, median=0.3 ms, max=59.66 ms, 99th percentile=7.891 ms
03:04:07.295:  ┃ ┃ ┃ ┣render_main_texture: min=0.012 ms, median=0.096 ms, max=38.695 ms, 99th percentile=6.595 ms
03:04:07.295:  ┃ ┃ ┃ ┣render_convert_texture: min=0.022 ms, median=0.052 ms, max=9.271 ms, 99th percentile=0.122 ms, 0.92409 calls per parent call
03:04:07.295:  ┃ ┃ ┃ ┗stage_output_texture: min=0.051 ms, median=0.135 ms, max=59.536 ms, 99th percentile=6.643 ms, 0.92409 calls per parent call
03:04:07.295:  ┃ ┃ ┣gs_flush: min=0 ms, median=0 ms, max=2.436 ms, 99th percentile=0 ms
03:04:07.295:  ┃ ┃ ┗download_frame: min=0 ms, median=0.003 ms, max=40.005 ms, 99th percentile=0.899 ms, 0.92409 calls per parent call
03:04:07.295:  ┃ ┗output_video_data: min=0.273 ms, median=0.402 ms, max=4.67 ms, 99th percentile=0.627 ms, 0.924082 calls per parent call
03:04:07.295:  ┗render_displays: min=0 ms, median=0.277 ms, max=248.897 ms, 99th percentile=8.698 ms
03:04:07.295: OBSBasic::ResetOutputs: min=0.492 ms, median=0 ms, max=6.552 ms, 99th percentile=6.552 ms
03:04:07.295: video_thread(video): min=2.692 ms, median=4.675 ms, max=75.057 ms, 99th percentile=7.769 ms
03:04:07.295:  ┗receive_video: min=2.691 ms, median=4.674 ms, max=52.224 ms, 99th percentile=7.756 ms
03:04:07.295:    ┗do_encode: min=2.69 ms, median=4.673 ms, max=52.222 ms, 99th percentile=7.755 ms
03:04:07.295:      ┗encode(streaming_h264): min=2.649 ms, median=4.649 ms, max=52.158 ms, 99th percentile=7.722 ms
03:04:07.295: =================================================
03:04:07.295: == Profiler Time Between Calls ==================
03:04:07.295: obs_hotkey_thread(25 ms): min=25.216 ms, median=29.249 ms, max=41.127 ms, 5.74157% within ±2% of 25 ms (0% lower, 94.2584% higher)
03:04:07.295: obs_graphics_thread(16.6667 ms): min=1.895 ms, median=16.605 ms, max=373.838 ms, 17.9219% within ±2% of 16.667 ms (43.2529% lower, 38.8253% higher)
03:04:07.295: =================================================
03:04:07.412: Number of memory leaks: 2
 

Narcogen

Active Member
If you get no frame drops with CBR on, then keep CBR on. If frames aren't dropping you aren't actually having a problem. If Restream is complaining that your bitrate is varying it's because like all providers they want CBR to be on.
 

devster

New Member
Ok, I'll recap, I can't seem to understand this.
  • I have CBR on (this is the screen)
    Screen-Shot-2020-04-06-18-04-57.62.png
  • OBS stats shows 0/X in Dropped frames (network)
  • despite the above the stream bitrate drops, and the log proves it:
    Code:
    02:29:50.833: [rtmp stream: 'adv_stream'] bitrate decreased to: 5500
    02:29:52.800: [rtmp stream: 'adv_stream'] bitrate decreased to: 600
    Also during these moments the network speed box remains green
  • The times when bitrate drops in the logs are reflected in the restream interface
  • During these moments stream quality obviously tanks
What is happening? Why do the logs show reduced bitrate with no dropped frames?
 

devster

New Member
Another example:
Screen-Shot-2020-04-06-21-37-08.92.png

with Twitch directly:
Screen-Shot-2020-04-06-21-39-33.17.png

and again logs showing something is happening locally:
Code:
21:30:43.657: [rtmp stream: 'adv_stream'] bitrate increased to: 6000, done
21:32:03.224: User switched to scene 'Game'
21:32:57.570: [rtmp stream: 'adv_stream'] going back to prev bitrate
21:32:57.570: [rtmp stream: 'adv_stream'] bitrate decreased to: 5400
21:32:58.575: [rtmp stream: 'adv_stream'] bitrate decreased to: 3900
21:32:59.809: [rtmp stream: 'adv_stream'] bitrate decreased to: 2500
21:33:11.047: [rtmp stream: 'adv_stream'] bitrate decreased to: 2300
21:33:12.161: [rtmp stream: 'adv_stream'] bitrate decreased to: 600
 

SpectreKid

Member
I think the best course of action right now is to backup your scenes and clean reinstall OBS. Also, do not enforce streaming settings.
 
Top