Question / Help 4K Window Capture for Destiny 2 lagging

bawitdaba

New Member
Hello,

I'm trying to capture the game Destiny 2 at 4K for local recording and stream the game at 720p.

I have a threadripper 1950X with 64 GB of RAM, and a GeForce 1080 Ti
21:42:33.651: CPU Name: AMD Ryzen Threadripper 1950X 16-Core Processor
21:42:33.651: CPU Speed: 3394MHz
21:42:33.651: Physical Cores: 16, Logical Cores: 32
21:42:33.651: Physical Memory: 65433MB Total, 57650MB Free
21:42:33.684: Initializing D3D11...
21:42:33.684: Available Video Adapters:
21:42:33.685: Adapter 1: NVIDIA GeForce GTX 1080 Ti
21:42:33.685: Dedicated VRAM: 3082813440
21:42:33.685: Shared VRAM: 4241084416
21:42:33.685: output 1: pos={0, 0}, size={3840, 2160}, attached=true
21:42:33.685: output 2: pos={3840, 0}, size={3840, 2160}, attached=true
21:42:33.687: Loading up D3D11 on adapter NVIDIA GeForce GTX 1080 Ti (0)
21:42:33.717: D3D11 loaded successfully, feature level used: 45056

When I record other games such as League of Legends or Counter Strike: GO I don't have any issues as these Game Capture just fine. Destiny 2 has strict Anti-Cheat measures and won't allow Game Capture to hook as Bungie considers this process in general cheating (sigh).

I tried a Display Capture which was unusable, I then tried a Window Capture with the game in Full Screen window. In Full Screen windowed the game is buttery smooth, but the preview and recording in OBS is very laggy. I even tried setting the output scaling in video to 1080p with a base canvas of 4K and it is still just as laggy/choppy.

Here is a log from League of Legends which is normal
22:00:17.382: ==== Replay Buffer Start ===========================================
22:01:11.034: [game-capture: 'League Game Capture'] attempting to hook process: League of Legends.exe
22:01:11.040: [game-capture: 'League Game Capture'] using helper (compatibility hook)
22:01:11.050: [game-capture: 'League Game Capture'] hook not loaded yet, retrying..
22:01:13.878: [game-capture: 'League Game Capture'] attempting to hook process: League of Legends.exe
22:01:15.511: [game-capture: 'League Game Capture'] capture stopped
22:01:17.894: [game-capture: 'League Game Capture'] attempting to hook process: League of Legends.exe
22:01:17.911: [game-capture: 'League Game Capture'] capture stopped
22:01:21.912: [game-capture: 'League Game Capture'] attempting to hook process: League of Legends.exe
22:01:21.928: [game-capture: 'League Game Capture'] capture stopped
22:01:25.929: [game-capture: 'League Game Capture'] attempting to hook process: League of Legends.exe
22:01:25.944: [game-capture: 'League Game Capture'] shared texture capture successful
22:03:28.651: [game-capture: 'League Game Capture'] d3d9 shared texture capture successful
22:03:28.661: [game-capture: 'League Game Capture'] shared texture capture successful
22:03:32.337: [game-capture: 'League Game Capture'] ----------------- d3d9 capture freed -----------------
22:03:34.019: [game-capture: 'League Game Capture'] d3d9 shared texture capture successful
22:03:34.028: [game-capture: 'League Game Capture'] shared texture capture successful
22:03:42.624: ---------------------------------
22:03:42.624: [x264 encoder: 'recording_h264'] settings:
22:03:42.624: rate_control: VBR
22:03:42.624: bitrate: 25000
22:03:42.624: buffer size: 50000
22:03:42.624: crf: 23
22:03:42.624: fps_num: 60
22:03:42.624: fps_den: 1
22:03:42.624: width: 1920
22:03:42.624: height: 1080
22:03:42.624: keyint: 250
22:03:42.624:
22:03:42.635: ==== Recording Start ===============================================
22:03:42.635: [ffmpeg muxer: 'adv_file_output'] Writing file 'C:/OBS/Record/2018-02-11 22-03-42.mp4'...
22:05:43.074: [game-capture: 'League Game Capture'] capture window no longer exists, terminating capture
22:05:43.074: [game-capture: 'League Game Capture'] capture stopped
22:05:45.337: [ffmpeg muxer: 'adv_file_output'] Output of file 'C:/OBS/Record/2018-02-11 22-03-42.mp4' stopped
22:05:45.337: Output 'adv_file_output': stopping
22:05:45.337: Output 'adv_file_output': Total frames output: 7314
22:05:45.337: Output 'adv_file_output': Total drawn frames: 7362
22:05:45.337: ==== Recording Stop ================================================
22:09:16.077: Output 'Replay Buffer': stopping
22:09:16.077: Output 'Replay Buffer': Total frames output: 32249
22:09:16.077: Output 'Replay Buffer': Total drawn frames: 31966 (32322 attempted)
22:09:16.077: Output 'Replay Buffer': Number of lagged frames due to rendering lag/stalls: 356 (1.1%)
22:09:16.078: ==== Replay Buffer Stop ============================================
22:09:16.078: Video stopped, number of skipped frames due to encoding lag: 1/32322 (0.0%)
22:09:16.159: warning: 2 frames left in the queue on closing
22:36:10.752: obs_graphics_thread(16.6667 ms): min=0.254 ms, median=1.674 ms, max=621.756 ms, 99th percentile=4.751 ms, 99.9046% below 16.667 ms
22:36:10.752: ┣tick_sources: min=0.001 ms, median=0.389 ms, max=619.352 ms, 99th percentile=1.894 ms
22:36:10.752: ┣output_frame: min=0.242 ms, median=0.86 ms, max=9.66 ms, 99th percentile=1.493 ms
22:36:10.752: ┃ ┣gs_context(video->graphics): min=0.175 ms, median=0.399 ms, max=9.277 ms, 99th percentile=1.098 ms
22:36:10.752: ┃ ┃ ┣render_video: min=0.018 ms, median=0.193 ms, max=3.459 ms, 99th percentile=0.967 ms
22:36:10.752: ┃ ┃ ┃ ┣render_main_texture: min=0.005 ms, median=0.165 ms, max=3.434 ms, 99th percentile=0.939 ms
22:36:10.752: ┃ ┃ ┃ ┣render_output_texture: min=0.002 ms, median=0.007 ms, max=0.133 ms, 99th percentile=0.011 ms
22:36:10.752: ┃ ┃ ┃ ┣render_convert_texture: min=0.001 ms, median=0.009 ms, max=0.179 ms, 99th percentile=0.014 ms
22:36:10.752: ┃ ┃ ┃ ┗stage_output_texture: min=0 ms, median=0.002 ms, max=0.035 ms, 99th percentile=0.004 ms
22:36:10.752: ┃ ┃ ┣download_frame: min=0 ms, median=0.002 ms, max=8.388 ms, 99th percentile=0.003 ms
22:36:10.752: ┃ ┃ ┗gs_flush: min=0.033 ms, median=0.11 ms, max=2.027 ms, 99th percentile=0.196 ms
22:36:10.752: ┃ ┗output_video_data: min=0.271 ms, median=0.319 ms, max=1.89 ms, 99th percentile=0.438 ms
22:36:10.752: ┗render_displays: min=0 ms, median=0.125 ms, max=5.888 ms, 99th percentile=0.347 ms

Here is a log from Destiny 2 window capture
22:16:59.865: [FFmpeg aac encoder: 'Local Recording'] bitrate: 320, channels: 2, channel_layout: 3
22:16:59.865:
22:16:59.882: ==== Recording Start ===============================================
22:16:59.882: [ffmpeg muxer: 'adv_file_output'] Writing file 'C:/OBS/Record/2018-02-11 22-16-59.mp4'...
22:18:51.386: [ffmpeg muxer: 'adv_file_output'] Output of file 'C:/OBS/Record/2018-02-11 22-16-59.mp4' stopped
22:18:51.386: Output 'adv_file_output': stopping
22:18:51.386: Output 'adv_file_output': Total frames output: 6611
22:18:51.386: Output 'adv_file_output': Total drawn frames: 4666 (6690 attempted)
22:18:51.386: Output 'adv_file_output': Number of lagged frames due to rendering lag/stalls: 2024 (30.3%)
22:18:51.387: ==== Recording Stop ================================================
22:18:51.392: Video stopped, number of skipped frames due to encoding lag: 140/6685 (2.1%)
22:18:51.862: warning: 2 frames left in the queue on closing

19:05:54.216: obs_graphics_thread(16.6667 ms): min=0.248 ms, median=5.592 ms, max=689.701 ms, 99th percentile=75.656 ms, 60.5426% below 16.667 ms
19:05:54.216: ┣tick_sources: min=0.002 ms, median=0.427 ms, max=682.601 ms, 99th percentile=19.981 ms
19:05:54.216: ┣output_frame: min=0.244 ms, median=2.79 ms, max=144.848 ms, 99th percentile=73.066 ms
19:05:54.216: ┃ ┣gs_context(video->graphics): min=0.103 ms, median=2.403 ms, max=144.465 ms, 99th percentile=72.651 ms
19:05:54.216: ┃ ┃ ┣render_video: min=0.026 ms, median=0.886 ms, max=9.128 ms, 99th percentile=1.286 ms
19:05:54.217: ┃ ┃ ┃ ┣render_main_texture: min=0.006 ms, median=0.837 ms, max=9.08 ms, 99th percentile=1.214 ms
19:05:54.217: ┃ ┃ ┃ ┣render_output_texture: min=0.002 ms, median=0.007 ms, max=1.476 ms, 99th percentile=0.014 ms
19:05:54.217: ┃ ┃ ┃ ┣render_convert_texture: min=0.001 ms, median=0.01 ms, max=0.692 ms, 99th percentile=0.019 ms
19:05:54.217: ┃ ┃ ┃ ┗stage_output_texture: min=0 ms, median=0.018 ms, max=1.297 ms, 99th percentile=0.07 ms
19:05:54.217: ┃ ┃ ┣download_frame: min=0 ms, median=1.627 ms, max=143.315 ms, 99th percentile=71.59 ms
19:05:54.217: ┃ ┃ ┗gs_flush: min=0.022 ms, median=0.075 ms, max=3.999 ms, 99th percentile=0.199 ms
19:05:54.217: ┃ ┗output_video_data: min=0.249 ms, median=0.347 ms, max=1.853 ms, 99th percentile=0.592 ms
19:05:54.217: ┗render_displays: min=0 ms, median=0.159 ms, max=54.077 ms, 99th percentile=5.316 ms
19:05:54.217: video_thread(video): min=0.001 ms, median=4.175 ms, max=61.336 ms, 99th percentile=19.197 ms
19:05:54.217: ┗receive_video: min=0 ms, median=0.907 ms, max=37.325 ms, 99th percentile=1.595 ms, 2.79381 calls per parent call
19:05:54.217: ┗do_encode: min=0.391 ms, median=0.906 ms, max=37.324 ms, 99th percentile=1.594 ms
19:05:54.217: ┣encode(recording_h264): min=0.753 ms, median=1.1 ms, max=37.312 ms, 99th percentile=1.635 ms, 0.505022 calls per parent call
19:05:54.217: ┗encode(streaming_h264): min=0.381 ms, median=0.561 ms, max=7.128 ms, 99th percentile=0.976 ms, 0.494978 calls per parent call

Any ideas?
 
Too much rendering stall. Looks like you let your GPU run into a bottleneck. Enable fps limit ingame and adjust ingame details, until GPU load stays under 95%.
 
Too much rendering stall. Looks like you let your GPU run into a bottleneck. Enable fps limit ingame and adjust ingame details, until GPU load stays under 95%.

This happens even when I run everything at x264 encoding which should be all CPU based right? I guess I don't understand why the GPU is coming into play so much here on a window capture

The game itself isn't taxing on the vram usage, but I guess that doesn't say much I suppose I can play around more with the ingame settings.

If I threw more hardware at it would that solve anything, like if I had a 2nd GPU dedicated to OBS would that resolve the issue or is it all due to in game rendering?
 
x264 vs. NVENC is only affecting your video encoding, not the scene rendering and scaling, which is always done via GPU.

A dedicated GPU might make things worse (most systems will reduce PCIe lanes from x16 to 2x8 with two GPUs).
More details at point 4.1:
https://obsproject.com/forum/threads/common-mistakes-and-how-to-avoid-them.78116/

Thanks this has been very helpful.

OBS uses the GPU to render your scene, as the GPU can handle that task very fast.

I wish there was a way to prefer CPU scene rendering as I have 32 threads to work with and my GPU is being utilized heavily by the game.

If I want to play the game at 4K HDR and record/stream at a lower res what would my best options be? I suppose I could look at a hardware capture card that does 4K, I have a magewell USB capture card, but it's only 1080p.

I've never used shadowplay, but would something like that be an option for acquiring the game video and feeding that into OBS? I hear that it works at the driver level and maybe wouldn't be as taxing on the GPU?
 
Shadowplay contains two parts which makes it so good
1. their own low level framebuffer access (they have two methods for accessing the frames with no additional PCIe load and very low latency)
2. NVENC encoder chip, that compresses those frames and put them into a video stream that will put very little load on the PCIe bus

That's why NVENC on OBS is still not performing as good as Shadowplay. OBS needs to access the frame buffer via DirectX which puts more load on the system (especially the PCIe bus) and additionally it needs to render the whole scene afterwards.
Only the NVENC itself can be used by OBS, which is nice for local recordings, as encoding via NVENC chip is not stressing your CPU and even the GPU load is only increased very little.
 
Back
Top