Question / Help Streaming via Twitch produces giant lag

MikeZed

New Member
I've recently installed OBS and set it up to stream Hearthstone to Twitch. I've been testing various configurations, but for 2 days straight the only result I achieved is a highly laggy stream. And by "laggy" I mean: 90% of the time the stream freeze-frames at the first frame of the game, shows "loading video" info (or the loading "circle") and nothing else happens. I've tried decreasing bitrate to brutal values like 100 kbps but nothing seems to work. Only once have I managed to stream a few seconds more or less smoothly but overall I can only produce this one giant lag-fest.

I've tested my upload speed several times and it produces values ranging between 4 - 8 Mbps.

00:42:01: Open Broadcaster Software v0.656b - 32bit (´・ω・`)
00:42:01: -------------------------------
00:42:01: CPU Name: Intel(R) Core(TM) i5-4210H CPU @ 2.90GHz
00:42:01: CPU Speed: 2893MHz
00:42:01: Physical Memory: 4095MB Total, 4095MB Free
00:42:01: stepping id: 3, model 60, family 6, type 0, extmodel 1, extfamily 0, HTT 1, logical cores 4, total cores 2
00:42:01: monitor 1: pos={0, 0}, size={1600, 900}
00:42:01: Windows Version: 6.3 Build 9600 (revision 17415)
00:42:01: Aero is Enabled
00:42:01: -------------------------------
00:42:01: OBS Modules:
00:42:01: Base Address Module
00:42:01: 01310000 OBS.exe
00:42:01: 67A50000 OBSApi.dll
00:42:01: 70C50000 DShowPlugin.dll
00:42:01: 70C20000 GraphicsCapture.dll
00:42:01: 70400000 NoiseGate.dll
00:42:01: 70C00000 PSVPlugin.dll
00:42:01: 70460000 scenesw.dll
00:42:01: ------------------------------------------
00:42:01: Adapter 1
00:42:01: Video Adapter: NVIDIA GeForce GTX 960M
00:42:01: Video Adapter Dedicated Video Memory: 3221225472
00:42:01: Video Adapter Shared System Memory: 1073676288
00:42:01: Video Adapter Output 1: pos={0, 0}, size={1600, 900}, attached=true
00:42:01: ------------------------------------------
00:42:01: Adapter 2
00:42:01: Video Adapter: Intel(R) HD Graphics 4600
00:42:01: Video Adapter Dedicated Video Memory: 0
00:42:01: Video Adapter Shared System Memory: 1879048192
00:42:01: =====Stream Start: 2015-11-22, 00:42:01===============================================
00:42:01: Multithreaded optimizations: On
00:42:01: Base resolution: 1600x900
00:42:01: Output resolution: 532x300
00:42:01: ------------------------------------------
00:42:01: Loading up D3D10 on NVIDIA GeForce GTX 960M (Adapter 1)...
00:42:01: ------------------------------------------
00:42:01: Audio Format: 48000 Hz
00:42:01: ------------------------------------------
00:42:01: Audio Channels: 2 Ch
00:42:01: Playback device Default
00:42:01: ------------------------------------------
00:42:01: Using desktop audio input: Głośniki (Realtek High Definition Audio)
00:42:01: Global Audio time adjust: 0
00:42:01: ------------------------------------------
00:42:01: Using auxilary audio input: Mikrofon (Realtek High Definition Audio)
00:42:01: Mic time offset: 0
00:42:01: ------------------------------------------
00:42:01: Audio Encoding: AAC
00:42:01: bitrate: 96
00:42:01: Using graphics capture
00:42:01: Trying to hook process: Hearthstone.exe
00:42:01: Scene buffering time set to 700
00:42:01: ------------------------------------------
00:42:01: Video Encoding: x264
00:42:01: fps: 30
00:42:01: width: 532, height: 300
00:42:01: preset: veryfast
00:42:01: profile: high
00:42:01: keyint: 250
00:42:01: CBR: yes
00:42:01: CFR: yes
00:42:01: max bitrate: 1500
00:42:01: buffer size: 1500
00:42:01: ------------------------------------------
00:42:01: SharedTexCapture hooked
00:42:03: Using RTMP service: Twitch
00:42:03: Server selection: rtmp://live-fra.twitch.tv/app
00:42:03: Interface: Realtek PCIe GBE Family Controller (ethernet, 100 mbps)
00:42:03: Completed handshake with rtmp://live-fra.twitch.tv/app in 484 ms.
00:42:04: SO_SNDBUF was at 65536
00:42:06: RTMPPublisher::SocketLoop: Increasing send buffer to ISB 131072 (buffer: 0 / 203776)
00:42:22: RTMPPublisher::SocketLoop: Increasing send buffer to ISB 262144 (buffer: 0 / 203776)
00:43:29: FlushBufferedVideo: Flushing 3 packets over 66 ms
00:43:29: Total frames encoded: 2603, total frames duplicated: 0 (0.00%)
00:43:29: Total frames rendered: 2625, number of late frames: 0 (0.00%) (it's okay for some frames to be late)
00:43:29:
00:43:29: Profiler time results:
00:43:29:
00:43:29: ==============================================================
00:43:29: video thread frame - [100%] [avg time: 0.885 ms] [children: 18%] [unaccounted: 82%]
00:43:29: | scene->Preprocess - [0.339%] [avg time: 0.003 ms]
00:43:29: | GPU download and conversion - [17.6%] [avg time: 0.156 ms] [children: 16.7%] [unaccounted: 0.904%]
00:43:29: | | flush - [16%] [avg time: 0.142 ms]
00:43:29: | | CopyResource - [0.565%] [avg time: 0.005 ms]
00:43:29: | | conversion to 4:2:0 - [0.113%] [avg time: 0.001 ms]
00:43:29: Convert444Thread - [100%] [avg time: 0.127 ms] [children: 96.9%] [unaccounted: 3.15%]
00:43:29: | Convert444toNV12 - [96.9%] [avg time: 0.123 ms]
00:43:29: encoder thread frame - [100%] [avg time: 0.281 ms] [children: 14.9%] [unaccounted: 85.1%]
00:43:29: | sending stuff out - [14.9%] [avg time: 0.042 ms]
00:43:29: ==============================================================
00:43:29:
00:43:29:
00:43:29: Profiler CPU results:
00:43:29:
00:43:29: ==============================================================
00:43:29: video thread frame - [cpu time: avg 0.303 ms, total 796.875 ms] [avg calls per frame: 1]
00:43:29: | scene->Preprocess - [cpu time: avg 0 ms, total 0 ms] [avg calls per frame: 1]
00:43:29: | GPU download and conversion - [cpu time: avg 0.101 ms, total 265.625 ms] [avg calls per frame: 1]
00:43:29: | | flush - [cpu time: avg 0.095 ms, total 250 ms] [avg calls per frame: 1]
00:43:29: | | CopyResource - [cpu time: avg 0.006 ms, total 15.625 ms] [avg calls per frame: 1]
00:43:29: | | conversion to 4:2:0 - [cpu time: avg 0 ms, total 0 ms] [avg calls per frame: 1]
00:43:29: Convert444Thread - [cpu time: avg 0.21 ms, total 546.875 ms] [avg calls per frame: 1]
00:43:29: | Convert444toNV12 - [cpu time: avg 0.21 ms, total 546.875 ms] [avg calls per frame: 1]
00:43:29: encoder thread frame - [cpu time: avg 0 ms, total 0 ms] [avg calls per frame: 1]
00:43:29: | sending stuff out - [cpu time: avg 0 ms, total 0 ms] [avg calls per frame: 1]
00:43:29: ==============================================================
00:43:29:
00:43:29: =====Stream End: 2015-11-22, 00:43:29=================================================
00:43:29: ~RTMPPublisher: Packet flush completed in 110 ms
00:43:29: ~RTMPPublisher: Send thread terminated in 0 ms
00:43:29: RTMPPublisher::SocketLoop: Graceful loop exit
00:43:29: ~RTMPPublisher: Socket thread terminated in 0 ms
00:43:29: ~RTMPPublisher: Final socket shutdown completed in 313 ms
00:43:29: Average send payload: 4917 bytes, average send interval: 24 ms
00:43:29: Number of times waited to send: 0, Waited for a total of 0 bytes
00:43:29: Number of b-frames dropped: 0 (0%), Number of p-frames dropped: 0 (0%), Total 0 (0%)
00:43:29: Number of bytes sent: 16900996
00:48:12: =====Stream Start: 2015-11-22, 00:48:12===============================================
00:48:12: Multithreaded optimizations: On
00:48:12: Base resolution: 1600x900
00:48:12: Output resolution: 532x300
00:48:12: ------------------------------------------
00:48:12: Loading up D3D10 on NVIDIA GeForce GTX 960M (Adapter 1)...
00:48:13: ------------------------------------------
00:48:13: Audio Format: 48000 Hz
00:48:13: ------------------------------------------
00:48:13: Audio Channels: 2 Ch
00:48:13: Playback device Default
00:48:13: ------------------------------------------
00:48:13: Using desktop audio input: Głośniki (Realtek High Definition Audio)
00:48:13: Global Audio time adjust: 0
00:48:13: ------------------------------------------
00:48:13: Using auxilary audio input: Mikrofon (Realtek High Definition Audio)
00:48:13: Mic time offset: 0
00:48:13: ------------------------------------------
00:48:13: Audio Encoding: AAC
00:48:13: bitrate: 96
00:48:13: Using graphics capture
00:48:13: Trying to hook process: Hearthstone.exe
00:48:13: Scene buffering time set to 700
00:48:13: ------------------------------------------
00:48:13: Video Encoding: x264
00:48:13: fps: 30
00:48:13: width: 532, height: 300
00:48:13: preset: veryfast
00:48:13: profile: high
00:48:13: keyint: 250
00:48:13: CBR: yes
00:48:13: CFR: yes
00:48:13: max bitrate: 1500
00:48:13: buffer size: 1500
00:48:13: ------------------------------------------
00:48:13: SharedTexCapture hooked
00:48:14: Using RTMP service: Twitch
00:48:14: Server selection: rtmp://live-fra.twitch.tv/app
00:48:14: Interface: Realtek PCIe GBE Family Controller (ethernet, 100 mbps)
00:48:15: Completed handshake with rtmp://live-fra.twitch.tv/app in 482 ms.
00:48:16: SO_SNDBUF was at 65536
00:48:17: RTMPPublisher::SocketLoop: Increasing send buffer to ISB 131072 (buffer: 0 / 203776)
00:48:33: RTMPPublisher::SocketLoop: Increasing send buffer to ISB 262144 (buffer: 0 / 203776)

If somebody could pinpoint what I;m doing wrong, I would be very glad :D
 

jbrouhard

New Member
Try changing your x264 preset to "ultrafast". Should alleviate the problem. I had this same problem with dual-core processors (You have a dual core, but it may register to Windows as quad core (hyperthreading)).
 

FerretBomb

Active Member
Don't bother with the Ultrafast thing. You aren't duping, dropping, or skipping frames. All that will do is make your stream look terrible, as it'll use a very poor compression method.
00:42:01: keyint: 250
Go into Settings->Advanced and set your Keyframe Interval to 2. It's required for streaming to Twitch, and really should be the default setting. This could definitely cause your stream to be rejected, and/or handled poorly on the ingest side.
Also:
00:42:06: RTMPPublisher::SocketLoop: Increasing send buffer to ISB 131072 (buffer: 0 / 203776)
00:42:22: RTMPPublisher::SocketLoop: Increasing send buffer to ISB 262144 (buffer: 0 / 203776)
It appears your connection is unstable. You aren't outright dropping any frames so it's less of an issue, but it can cause buffering for viewers due to erratic upload rate. Just something to be aware of, and maybe consider trying a few other servers to see if you get a stronger connection. Can also use R1ch's Twitch Bandwidth Tester to check quickly if any of the other nearby servers are of a higher quality connection.
http://www.teamliquid.net/forum/tech-support/478845-twitchtest-twitch-bandwidth-tester
 

MikeZed

New Member
Thank you for your advice.

What seemed to help temporarily was streaming in the middle of the night (3 A.M. CET), which allowed me to have a stable-ish connection at 1400 kbps bandwidth. But now the problem seems to be back.

@FerretBomb. I've tested the R1ch's Twitch Bandwidth Tester and the results i got are:
On all European servers
Bandwidth 7400 - 7900 , RTT 99 - 120, quality 82 - 83

I'm guessing the problem lies with my internet provider whom I should promptly go and punch in the face until I get the promised 7Mbps bandwidth.

PS: I've also directly plugged into my router via Ethernet Cable - just so we get this issue out of the way.

PS2: This is what's happening on the receiving end of Twitch:
twitch.png
 
Last edited:

sam686

Member
Run some speed testing website (maybe speedtest.net is one of them), tell us both your download and upload speed?

Streaming uses upload speed (yours might be ok), while watching any twitch stream (including yourself) uses download.

If the lag is caused by not enough download speed, then this shouldn't effect other viewers, but will have problems being able to watch most other streams. When getting excessive buffering on twitch stream, pause/resume may reduce lag/delay for a while, if the problem is your limited download speed.

Edit: maybe while livestreaming try command prompt: ping -t google.com (ctrl+c to stop)
 
Last edited:

MikeZed

New Member
Yes. I've fixed the keyframe interval.

My speedtest results:

Download:
Code:
:::.. Download Speed Test Result Details ..:::
Download Connection Speed:: 11323 Kbps or 11.3 Mbps 
Download Speed Test Size:: 19.3 MB or 19776 kB or 20250624 bytes
Download Binary File Transfer Speed:: 1415 kB/s or 1.4 MB/s
Tested At:: http://TestMy.net  Version 15
Validation:: http://testmy.net/db/kMFJonsvE
TiP Measurement Summary:: Min 9.27 Mbps | Middle Avg 11.64 Mbps | Max 15.65 Mbps | 51% Variance
TiP Data Points:: 9.75 Mbps, 9.81 Mbps, 10.65 Mbps, 11.53 Mbps, 12.08 Mbps, 11.56 Mbps, 11.72 Mbps, 11.05 Mbps, 10.24 Mbps, 11.3 Mbps, 12.89 Mbps, 13.18 Mbps, 13.81 Mbps, 15.65 Mbps, 11.53 Mbps, 9.27 Mbps, 10.53 Mbps, 11.1 Mbps, 10.64 Mbps
Client Stats:: http://testmy.net/compID/76217096044  
Test Time:: 2015-11-22 18:22:21 Local Time 
Client Location:: Warsaw, PL PL http://testmy.net/city/warsaw_pl
Target:: Frankfurt, DE http://de.testmy.net
Client Host:: Orange Polska http://testmy.net/hoststats/orange_polska
Compare:: 168% faster than client avg, 42% faster than host avg, 42% slower than city avg, 40% slower than country avg, 14% faster than world index 
1MB Download in 0.72 Seconds - 1GB Download in ~12 Minutes - 202X faster than 56K
This test of exactly 19776 kB took 14.329 seconds to complete
User Agent:: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36 [!]
Upload:
Code:
:::.. Upload Speed Test Result Details ..:::
Upload Connection Speed:: 6449 Kbps or 6.4 Mbps
Upload Speed Test Size:: 3 MB or 3040 kB or 3112960 bytes
Upload Binary File Transfer Speed:: 806 kB/s
Tested At:: http://TestMy.net  Version 15
Validation:: http://testmy.net/db/fSUOvB3yo
Client Stats:: http://testmy.net/compID/76217096044 
Test Time:: 2015-11-22 18:16:46 Local Time
Client Location:: Warsaw, PL PL http://testmy.net/city/warsaw_pl
Target:: Frankfurt, DE http://de.testmy.net
Client Host:: Orange Polska http://testmy.net/hoststats/orange_polska
Compare:: 309% faster than client avg, 65% faster than host avg, 37% faster than city avg, 66% faster than country avg, 85% faster than world index
1MB Upload in 1.27 Seconds - 1GB Upload in ~22 Minutes - 115X faster than 56K
This test of exactly 3040 kB took 3.862 seconds to complete
User Agent:: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36 [!]
 

MikeZed

New Member
Update: Ok, it seems the problem lay in downloading the video I had uploaded and not in the upload, which gave a false negative. I just need to ask a couple of friends to confirm the stream runs smoothly for them.
 
Top