X264: which -tune for best live streaming quality without increased bitrate

bitratevideo streamingx264

I am trying to stream an FPS shooter game from OBS 20.0.1 at the lowest bitrate possible whilst maintaining the best quality possible (i.e. less blocky pixels).

I am concerned that more reference-frames will increase my bitrate. So since this is high-motion streaming, should I use -tune animation to boost deblocking? Or would PSNR or SSIM be more promising candidates?

Is there any better/other way to test which -tune-option is best than trying them with test-streams?

Also, are there any other x264-options that my stream would benefit from, but which are not included in OBS?

My OBS setup:
OBS Setup

My hardware:

  • CPU: Intel i7-4770k
  • GPU: Nvidia GTX780 Ti
  • RAM: 12GB, 1600MHz

Best Answer

I am trying to stream an FPS shooter game from OBS 20.0.1 at the lowest bitrate possible whilst maintaining the best quality possible (i.e. less blocky pixels).

You can do this, but it will take a lot of encoding time. Since you're live-streaming, I assume that you want a single encoding pass, and preferably one that is fast, i.e. maxes out your CPU resources. Thus, you should play around with the CPU speed preset – choose the highest that you can tolerate.

It's impossible to optimize all these parameters (speed, quality, bitrate) at the same time, which is why x264 (and other encoders) offer a way to select the speed preset (e.g., from ultrafast to veryslow in x264). These presets enable/disable certain options that optimize compression quality or minimize encoding time, respectively.

I am concerned that more reference-frames will increase my bitrate

That is generally true, as these are much larger.

So since this is high-motion streaming, should I use -tune animation to boost deblocking? Or would PSNR or SSIM be more promising candidates?

Have a look at this other post, where the tune modes are explained.

For your particular case of live streaming at low latency, with one encoding pass, it does not make sense to use film. This is for preserving (grainy) detail.

Your worries about blockiness with low bitrate are understandable, but the animation preset does not make sense for live streaming, since it would also increase the number of B-frames, which you anyway want to set to 0 (or a low number) to allow fast encoding. B-frames require past and future frames to be encoded, meaning that the encoder/decoder has to keep a larger buffer to store these frames. The more B-frames, the better the quality, at the expense of encoding time.

The psnr and ssim modes aren't useful either; they're used during encoder development / optimization only and might actually result in worse subjective quality.

Perhaps zerolatency better fits your use case?

Is there any better/other way to test which -tune-option is best than trying them with test-streams?

You could, in theory, encode a few original streams, then encode them with different settings, and run them through a full-reference video quality analyzer like VQMT or VMAF. These will give you a quality score for the encodes. But I guess that visually inspecting the results is also sufficient in your case.

Related Question