Question / Help Issues with encoding lag NVENC

Hanana

New Member
Hello. I am having issues with encoding lag , my pc specs are as listed , i5 3570 , GTX1070 , 8GB RAM. Videos are all recorded into an External 1TB USB3.0 HDD (tried SSD , issue persisted)

Here's the thing , whenever I try to record a video , there will be encoding lags randomly within the recorded video. Games that I've tried are , Dying Light , CSGO , GTA 5 , all of them have the same issues. I thought my pc is more than enough to be recording videos since I'm using NVENC that offload most if not all of the recording workloads onto the GPU itself? But that doesn't explain it too , since CSGO isn't a very GPU intensive game , I have all my settings set to lowest in that game except for 2x AA.

But what I am currently suspecting is that the 3 games that I have tested are very CPU intensive , so that might why it is causing encoding lags? From what I have tested , Shadowplay on the other hand doesn't seem to have issues with random stutters in the recorded footage though , even though recorded at a higher bitrate than what I am using on OBS. What exactly is causing this? Thanks a lot.

Code:
22:37:03.479: [Media Foundation AAC: 'Track1']: encoder created
22:37:03.479:     bitrate: 160
22:37:03.479:     channels: 2
22:37:03.479:     sample rate: 44100
22:37:03.479:     bits-per-sample: 16
22:37:03.479: 
22:37:03.480: [Media Foundation AAC: 'Track2']: encoder created
22:37:03.480:     bitrate: 160
22:37:03.480:     channels: 2
22:37:03.480:     sample rate: 44100
22:37:03.480:     bits-per-sample: 16
22:37:03.480: 
22:37:03.489: ==== Recording Start ===============================================
22:37:03.489: [ffmpeg muxer: 'adv_file_output'] Writing file 'F:/Recordings/2017-04-12 22-37-02.mp4'...
23:29:30.417: [game-capture: 'Game Capture'] capture window no longer exists, terminating capture
23:29:30.418: [game-capture: 'Game Capture'] capture stopped
23:29:33.335: [ffmpeg muxer: 'adv_file_output'] Output of file 'F:/Recordings/2017-04-12 22-37-02.mp4' stopped
23:29:33.335: Output 'adv_file_output': stopping
23:29:33.335: Output 'adv_file_output': Total encoded frames: 188985
23:29:33.335: Output 'adv_file_output': Total drawn frames: 188991
23:29:33.335: Output 'adv_file_output': Number of skipped frames due to encoding lag: 2938 (1.6%)
23:29:33.335: Output 'adv_file_output': Number of lagged frames due to rendering lag/stalls: 5 (0.0%)
23:29:33.336: ==== Recording Stop ================================================
23:51:02.867: ---------------------------------
23:51:02.867: video settings reset:
23:51:02.867:     base resolution:   1920x1080
23:51:02.867:     output resolution: 1280x720
23:51:02.867:     downscale filter:  Lanczos
23:51:02.867:     fps:               60/1
23:51:02.867:     format:            NV12
23:51:02.872: Settings changed (advanced)
23:51:02.872: ------------------------------------------------
00:52:57.880: ==== Shutting down ==================================================
00:52:57.896: Switched to scene '(null)'
00:52:57.901: WASAPI: Device 'Speakers (Realtek High Definition Audio)' Terminated
00:52:57.923: WASAPI: Device 'Microphone (USB PnP Sound Device)' Terminated
00:52:58.044: All scene data cleared
00:52:58.044: ------------------------------------------------
00:52:58.115: Freeing OBS context data
00:52:58.740: == Profiler Results =============================
00:52:58.740: run_program_init: 6671.2 ms
00:52:58.740:  ┣OBSApp::AppInit: 7.575 ms
00:52:58.740:  ┃ ┗OBSApp::InitLocale: 4.893 ms
00:52:58.740:  ┗OBSApp::OBSInit: 6647.61 ms
00:52:58.740:    ┣obs_startup: 2.526 ms
00:52:58.740:    ┗OBSBasic::OBSInit: 6528.21 ms
00:52:58.740:      ┣OBSBasic::InitBasicConfig: 0.571 ms
00:52:58.740:      ┣OBSBasic::ResetAudio: 0.445 ms
00:52:58.740:      ┣OBSBasic::ResetVideo: 1681.65 ms
00:52:58.740:      ┣OBSBasic::InitOBSCallbacks: 0.022 ms
00:52:58.740:      ┣OBSBasic::InitHotkeys: 0.107 ms
00:52:58.740:      ┣obs_load_all_modules: 261.499 ms
00:52:58.740:      ┃ ┣obs_init_module(coreaudio-encoder.dll): 0.95 ms
00:52:58.740:      ┃ ┣obs_init_module(enc-amf.dll): 0.434 ms
00:52:58.740:      ┃ ┣obs_init_module(frontend-tools.dll): 4.625 ms
00:52:58.740:      ┃ ┣obs_init_module(image-source.dll): 0.014 ms
00:52:58.740:      ┃ ┣obs_init_module(obs-browser.dll): 0.062 ms
00:52:58.740:      ┃ ┣obs_init_module(obs-ffmpeg.dll): 0.864 ms
00:52:58.740:      ┃ ┣obs_init_module(obs-filters.dll): 0.027 ms
00:52:58.740:      ┃ ┣obs_init_module(obs-outputs.dll): 0.009 ms
00:52:58.740:      ┃ ┣obs_init_module(obs-qsv11.dll): 78.603 ms
00:52:58.740:      ┃ ┣obs_init_module(obs-text.dll): 0.628 ms
00:52:58.740:      ┃ ┣obs_init_module(obs-transitions.dll): 0.022 ms
00:52:58.740:      ┃ ┣obs_init_module(obs-vst.dll): 0.003 ms
00:52:58.740:      ┃ ┣obs_init_module(obs-x264.dll): 0.005 ms
00:52:58.740:      ┃ ┣obs_init_module(rtmp-services.dll): 0.287 ms
00:52:58.740:      ┃ ┣obs_init_module(text-freetype2.dll): 0.069 ms
00:52:58.740:      ┃ ┣obs_init_module(vlc-video.dll): 0.052 ms
00:52:58.740:      ┃ ┣obs_init_module(win-capture.dll): 0.109 ms
00:52:58.740:      ┃ ┣obs_init_module(win-decklink.dll): 5.529 ms
00:52:58.740:      ┃ ┣obs_init_module(win-dshow.dll): 2.028 ms
00:52:58.740:      ┃ ┣obs_init_module(win-mf.dll): 115.136 ms
00:52:58.740:      ┃ ┣obs_init_module(win-wasapi.dll): 0.006 ms
00:52:58.740:      ┃ ┗reset_win32_symbol_paths: 0.279 ms
00:52:58.740:      ┣OBSBasic::ResetOutputs: 1.372 ms
00:52:58.740:      ┣OBSBasic::CreateHotkeys: 0.955 ms
00:52:58.740:      ┣OBSBasic::InitService: 0.92 ms
00:52:58.740:      ┣OBSBasic::InitPrimitives: 0.504 ms
00:52:58.740:      ┗OBSBasic::Load: 4311.95 ms
00:52:58.740: obs_hotkey_thread(25 ms): min=0.002 ms, median=0.005 ms, max=226.405 ms, 99th percentile=0.049 ms, 99.9973% below 25 ms
00:52:58.740: audio_thread(Audio): min=0 ms, median=0.049 ms, max=1473 ms, 99th percentile=2.494 ms
00:52:58.741:  ┗receive_audio: min=0.005 ms, median=0.276 ms, max=1472.67 ms, 99th percentile=2.199 ms, 0.740876 calls per parent call
00:52:58.741:    ┣buffer_audio: min=0 ms, median=0.001 ms, max=1.475 ms, 99th percentile=0.003 ms
00:52:58.741:    ┗do_encode: min=0.054 ms, median=0.26 ms, max=1472.65 ms, 99th percentile=2.174 ms
00:52:58.741:      ┣encode(Track2): min=0.107 ms, median=0.152 ms, max=3.663 ms, 99th percentile=0.452 ms, 0.500004 calls per parent call
00:52:58.741:      ┗encode(Track1): min=0.05 ms, median=0.252 ms, max=3.551 ms, 99th percentile=0.858 ms, 0.499996 calls per parent call
00:52:58.741: obs_video_thread(16.6667 ms): min=0.401 ms, median=1.411 ms, max=4233.8 ms, 99th percentile=2.804 ms, 99.9928% below 16.667 ms
00:52:58.741:  ┣tick_sources: min=0.001 ms, median=0.014 ms, max=4232.44 ms, 99th percentile=0.108 ms
00:52:58.741:  ┣render_displays: min=0.001 ms, median=0.681 ms, max=224.709 ms, 99th percentile=1.608 ms
00:52:58.741:  ┗output_frame: min=0.165 ms, median=0.663 ms, max=57.189 ms, 99th percentile=1.593 ms
00:52:58.741:    ┣gs_context(video->graphics): min=0.107 ms, median=0.221 ms, max=56.706 ms, 99th percentile=0.609 ms
00:52:58.741:    ┃ ┣render_video: min=0.024 ms, median=0.116 ms, max=8.734 ms, 99th percentile=0.363 ms
00:52:58.741:    ┃ ┃ ┣render_main_texture: min=0.003 ms, median=0.037 ms, max=3.81 ms, 99th percentile=0.159 ms
00:52:58.741:    ┃ ┃ ┣render_output_texture: min=0.003 ms, median=0.034 ms, max=3.639 ms, 99th percentile=0.156 ms
00:52:58.741:    ┃ ┃ ┣render_convert_texture: min=0.001 ms, median=0.035 ms, max=8.547 ms, 99th percentile=0.166 ms
00:52:58.741:    ┃ ┃ ┗stage_output_texture: min=0 ms, median=0.003 ms, max=1.858 ms, 99th percentile=0.01 ms
00:52:58.741:    ┃ ┣download_frame: min=0 ms, median=0.002 ms, max=2.088 ms, 99th percentile=0.008 ms
00:52:58.741:    ┃ ┗gs_flush: min=0.029 ms, median=0.093 ms, max=56.499 ms, 99th percentile=0.255 ms
00:52:58.741:    ┗output_video_data: min=0.001 ms, median=0.425 ms, max=5.424 ms, 99th percentile=1.202 ms
00:52:58.741: video_thread(video): min=0 ms, median=1.378 ms, max=1481.74 ms, 99th percentile=2.734 ms
00:52:58.741:  ┗receive_video: min=0 ms, median=1.513 ms, max=1481.74 ms, 99th percentile=2.885 ms, 0.684318 calls per parent call
00:52:58.741:    ┗do_encode: min=0.664 ms, median=1.512 ms, max=1481.73 ms, 99th percentile=2.883 ms
00:52:58.741:      ┗encode(recording_h264): min=0.63 ms, median=1.384 ms, max=3.011 ms, 99th percentile=1.886 ms
00:52:58.741: OBSBasic::ResetVideo: 9.174 ms
00:52:58.741: obs_video_thread(16.6667 ms): min=0.716 ms, median=1.191 ms, max=53.528 ms, 99th percentile=2.507 ms, 99.9946% below 16.667 ms
00:52:58.741:  ┣tick_sources: min=0.001 ms, median=0.008 ms, max=6.748 ms, 99th percentile=0.029 ms
00:52:58.741:  ┣render_displays: min=0.002 ms, median=0.561 ms, max=50.134 ms, 99th percentile=1.533 ms
00:52:58.741:  ┗output_frame: min=0.127 ms, median=0.599 ms, max=26.393 ms, 99th percentile=1.015 ms
00:52:58.741:    ┣gs_context(video->graphics): min=0.109 ms, median=0.177 ms, max=25.91 ms, 99th percentile=0.44 ms
00:52:58.741:    ┃ ┣render_video: min=0.022 ms, median=0.088 ms, max=25.497 ms, 99th percentile=0.275 ms
00:52:58.741:    ┃ ┃ ┣render_main_texture: min=0.003 ms, median=0.005 ms, max=1.282 ms, 99th percentile=0.029 ms
00:52:58.741:    ┃ ┃ ┣render_output_texture: min=0.002 ms, median=0.037 ms, max=9.522 ms, 99th percentile=0.171 ms
00:52:58.741:    ┃ ┃ ┣render_convert_texture: min=0.001 ms, median=0.034 ms, max=25.394 ms, 99th percentile=0.183 ms
00:52:58.741:    ┃ ┃ ┗stage_output_texture: min=0 ms, median=0.002 ms, max=0.763 ms, 99th percentile=0.018 ms
00:52:58.741:    ┃ ┣download_frame: min=0 ms, median=0.002 ms, max=0.645 ms, 99th percentile=0.008 ms
00:52:58.742:    ┃ ┗gs_flush: min=0.027 ms, median=0.074 ms, max=7.636 ms, 99th percentile=0.223 ms
00:52:58.742:    ┗output_video_data: min=0.262 ms, median=0.41 ms, max=7.253 ms, 99th percentile=0.64 ms
00:52:58.742: video_thread(video): min=0 ms, median=0.001 ms, max=6.854 ms, 99th percentile=0.002 ms
00:52:58.742: =================================================
00:52:58.742: == Profiler Time Between Calls ==================
00:52:58.742: obs_hotkey_thread(25 ms): min=22.377 ms, median=25.046 ms, max=1292.68 ms, 94.195% within ±2% of 25 ms (0.00150395% lower, 5.80346% higher)
00:52:58.742: obs_video_thread(16.6667 ms): min=1.446 ms, median=16.667 ms, max=4233.84 ms, 96.0467% within ±2% of 16.667 ms (1.97986% lower, 1.97341% higher)
00:52:58.742: obs_video_thread(16.6667 ms): min=1.142 ms, median=16.667 ms, max=57.631 ms, 97.7013% within ±2% of 16.667 ms (1.15789% lower, 1.14084% higher)
00:52:58.742: =================================================
00:52:58.984: Number of memory leaks: 1
[Code]
 

Boildown

Active Member
You'll need to post your entire log file, use a text file hosting site like pastebin.

23:29:33.335: Output 'adv_file_output': Number of skipped frames due to encoding lag: 2938 (1.6%)
Definitely something is off, but I can't tell what.
 

Hanana

New Member
You'll need to post your entire log file, use a text file hosting site like pastebin.


Definitely something is off, but I can't tell what.
Sorry , but I've checked again , this is the entire log file that was used during that session test. Any help would definitely be much appreciated! Also , this is on a clean install of Windows , and a new Graphics card , previous one was AMD 7850 which didn't have a problem with encoding lag but it appeared later on as well , presumably by newer versions of OBS because I recalled reinstalling OBS. So I accepted that the card then was too old and weak for recordings , so I got myself a 1070 , didn't expect this to happen honestly.

Edit : Opps , i really did miss out on the code , sorry. Here's the complete one. https://pastebin.com/YeC1KYrt
 
Last edited:
D

Deleted member 70571

Limit or sync your FPS to your refresh rate if you haven't.
 

Hanana

New Member
Limit or sync your FPS to your refresh rate if you haven't.
I am using 144hz to game , isn't that impossible to record in 144fps? And in some games I might not be able to reach that high anyway , plus games like CSGO where I would definitely want my fps to be uncapped though.
 

Boildown

Active Member
22:37:02.562: preset: bd

Not sure what the bd preset is, but try using High Quality (hq) or High Performance (hp) and see if its better.

Some of your settings look like they're intended for streaming, but you're saving to disk. Do you intend to stream too?
 

Hanana

New Member
u can try fractures -> like 72fps or 36 fps

but afaik NVenc adds some lags due to how it does its magic
Sorry , I don't quite get what you mean by this , so by that I assume you're asking me to record in either 72fps or 36fps?
Not sure what the bd preset is, but try using High Quality (hq) or High Performance (hp) and see if its better.

Some of your settings look like they're intended for streaming, but you're saving to disk. Do you intend to stream too?
Yes , some of the streaming settings were set just to test out streaming , though I have no idea if there were any encoding lags/frame drops or not , because its harder to monitor as to recording.

As to the "bd" preset , I think it's the Bluray preset that i used , I'll try your suggestions soon. Been testing everything but to no avail , didn't even get any sleep last night :(

Pretty disappointed at this point , I got the 1070 solely because I could play higher quality games and some smooth recordings...
 

Hanana

New Member
After days of trying to fix the issue , I've came down to the conclusion that recording into my USB3 1TB Seagate external HDD was the cause , I have no idea why it is happening since it has faster write speeds than my other 2 older HDD. Even my dying HDD doesn't have issue with encoding lag after I've checked. It might be something thats conflicting via USB? No idea.
 
Top