Question / Help BF4 stuttering issue - collected info so far

Rezal

New Member
There seems to be a general issue with BF4/recorded video becoming stuttery while using OBS. I've done some extensive testing and will continue to do so with every promising release of OBS. What I have found out so far:

-Stuttering is caused by varying frametimes of GPU, not CPU

-When the maximum of the framtimes comes close to the rate you are recording/streaming at, frames will be dropped/duped, effectively giving you things like 45 fps instead of 60

-Things that do no seem to influence it: encoder or encoder settings, bitrate, CBR/VBR, buffer. Unless I am actually CPU bound, x264 fast is just as good as QSV TU7 main profile or NVENC
-user.cfg or console commands, unless they actually significantly improve your framerate

-Messing around with thread priorities, affinities and hyperthreading did not do anything.

The only ways to alleviate the issue I am aware of are:
-Making sure your setup is fast as hell. Recording 1080p60 when I would get 80 fps without OBS does stutter, much better when I could get 90 or even 100 fps. Being able to run much faster than the target framerate is good.

-Limiting framerate or Vsync can help, but it does not help all the time. Basically some scenes will always stutter, some might randomly start/stop stuttering when your framerate is limited.

-Reducing the video frame size seems the only workaround on OBS side, same goes for framerate. Apparently once too many pixels/second have to be processed, things will go awry. Note that the resampling filter does not matter. Bilinear or Lanczos, no difference. Maybe this helps one of the devs to track down the exact problem.

As a side note, I have seen many stupid/useless/outright bad user.cfg files. Here is an example of a good user.cfg:
Code:
gametime.maxvariablefps 60
perfoverlay.drawfps 1
#Render.DrawScreenInfo 1
#perfoverlay.drawgraph 1
worldrender.lighttilecspathenable 0
Explanation:
Line 1: Limits your fps to 60 (orly), which at least helps to reduce stuttering for me a little. If you want to limit your fps, I'd recommend you monitor's refresh rate.
Line 2: fps counter in top right corner
Line 3: Draws some screen info (API, display and internal resolution, number of threads), is useful for some stuff, however the # disables the command
Line 4: Draws CPU and GPU rendering in bottom left corner, useful diagnosing stuttering. Also disabled by the #, as it has annoying qualities for regular playing.
Line 5: This is the only command that actually has a meaningful impact on your framerate and is not accessible via the menu. Default would be 1, on my PC 0 tends to be better. Depends on PC and map. No difference in rendered image.

Other commands are usually stupid (do you really think the user interface is turned off by default?), removed, pointless or can even reduce your performance significantly.

If you have ideas regarding the stuttering, post them please. If you are a dev and think you can help, I will happily provide you with all information you desire and will also test the shit out of every build.
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Quite an insightful and well-written post. I appreciate you taking the time to do this.

That being said, the main issue with frames being duplicated is of course framerate. OBS is a compositor, so if the game drops below OBS' designated framerate, it will cause frame duplication simply because of framerate of the game having overlaps with the framerate of OBS, and thus on occasion missing frames. Having a fast computer is of course going to be the best way to ensure that this doesn't happen as you said.

Problem with BF4 is it's so CPU/GPU intensive that almost everyone has some issues with it when using OBS, and their results usually come down to their PC power and settings. OBS of course will use less CPU/GPU when downscaled and at lower framerates.

If you do 1080p 60fps with BF4 you're going to require an amazing beast of a computer to be able to handle it smoothly, but then again we don't recommend that for streams regardless.
 

Rezal

New Member
Well, while BF4 tends to use lots of CPU, the stuttering in GPU render times is not cause by that. I've observed as low as 20% CPU utilization during stuttering.

Unfortunately, I'm not a coder and also not familiar with the process how OBS captures the video, but the whole behavior seems odd. I've ruled out encoder settings/encoder performance as the cause of the issue, CPU utilization also seems unrelated. It also does not matter how much is captured initially (2560*1080 is just as good as 1920*1080), the only thing that matters is how much data is passed on to the encoder eventually (yet as I've said, raw encoder performance is irrelevant)...

On a side note, BF4 (BF3 as well) has some weird CPU/GPU load interaction. If you limit your framerate, you will usually have a fairly low CPU utilization, however, if your GPU gets maxed out, CPU usage will skyrocket as well. For example, if your setup could do 66 fps, limited by your GPU's performance, and your limit your framerate to 60, you might get say 30% CPU utilization. Removing that fps limit, you'd expect CPU utilization to slighlty rise, as it has to prepare a few more frames for the GPU. But instead it might go as high as 80%, way more than you would expect for such a small increase in fps.

Edit: Recording in Dxtory using x264 vfw does not cause the stuttering issue like OBS. It seems like Dxtory does something better than OBS there...
 

Rezal

New Member
Will stick with Dxtory for now, which seems to have the contrary effect of OBS. It actually evens out GPU frame times. I will keep a close look at OBS and test every release, though.
 

Rezal

New Member
Tried 0.624b, still stuttering. Dxtory is the only software that does not cause stutter in BF4 besides (unusable at my resolution) Shadowplay.

Is there a difference in how frames are captured between OBS and Dxtory?
 
Top