0

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
flolilo
  • 2,700
  • 1
  • 18
  • 27
Trr1ppy
  • 25
  • 1
  • 1
  • 5
  • your link is broken. why not put the code into the question? also, have you read through [FFmpeg's Streaming Guide](https://trac.ffmpeg.org/wiki/StreamingGuide)? – flolilo Oct 11 '17 at 10:51
  • also, read through [this post about x264's tune-modes](https://superuser.com/questions/564402/explanation-of-x264-tune/564404#564404). – flolilo Oct 11 '17 at 10:59
  • FFmpegs streaming guide only says use -zero latency and the x264 tune-modes post isnt in depth enough for me to make an informed decision, but If i had to guess the best I'd go with Animation from reading the post – Trr1ppy Oct 11 '17 at 12:32
  • Not trying to be rude, but since you're talking about the holy grail (**fast** encoder that needs only a **small bitrate** for **visually superior** results), I don't think that you understand the importance (or the lack of it) of the `-tune`-parameter in x264. If using `-tune PSNR` would lead to better results with less bitrate in less time, then I'd think that everyone would use (and promote) it, especially since we are talking about an open source tool that is well documented and discussed. – flolilo Oct 11 '17 at 13:15
  • I think you're correct, I was just hopping there would be a h264 expert with an extensive knowledge on how the tune parameters effect the encoding algorithm. I think the tune parameters arent very well discussed for the case of streaming but probably because like you said "lack of importance". What I should of looked up is what peoples stream pc's use for their tune parameter, and I dare say Itll be the -tune film parameter because they will have high bitrates I think in summation for low bitrates -tune animation will be best to reduce blocking on low quality streams – Trr1ppy Oct 11 '17 at 15:20

3 Answers3

0

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.

slhck
  • 223,558
  • 70
  • 607
  • 592
  • 1
    Oh, and I should add that the OBS forum is probably a good place to ask, since your questions are very specific to streaming gaming videos, which is a kind of niche application. – slhck Oct 11 '17 at 15:54
  • Thank you for your very informative answer, For clarification If I increase B-Frames the encoder will take longer and longer to process to the point where I cant encode in real time, and decreasing B-Frames will speed up encoding at the expense of quality? Also are Keyframes related to B-frames, Keyframes seems to specify the frequency of B-Frames? I want to use as much computer resources as possible whilst remaining real time encoding (obviously because I'm streaming). – Trr1ppy Oct 12 '17 at 07:52
  • 1) Yes, although the delay will not be *too* large. The smaller your keyframe interval, the smaller the encoding delay when using more B-frames. 2) No, the keyframe interval sets the interval between I-frames. The `bframes` setting in x264 determines the maximum number of B-frames in succession; if not using B-frames, the encoder will fill it with P-frames. Perhaps in your case, don't use more than 1-2 B-frames (if at all) and try to keep the keyframe interval short (my guess: 3-4 seconds?). Hard to give an exact answer, you'd really have to check the resulting quality. – slhck Oct 12 '17 at 09:55
0

Tune settings are not intended for high/low quality but to optimise appearance for a given source type.

Tune animation is for cel based (flat) animation. Not suitable for game streaming.

Tune film is for live action video or film, but CGI of sufficient realism (eg, fine textures) can also benefit from it. No problems giving it a try.

No other tune setting is likely to be suitable. The most important is to use the "faster" preset (or better) as all the lower quality presets significantly degrade quality. Also important to give it enough bitrate. Note that x264 will use a fair bit of CPU so be prepared for that. A hardware encoder such as NVENC may help with this to some degree but with slightly lower quality video.

There is no point tuning for low latency unless your platform forces it, as that is not required to stream your game (ie, viewers won't be affected if there's a fraction of a second latency on top of the several seconds it already has).

thomasrutter
  • 1,893
  • 1
  • 18
  • 32
-1

The tune parameter doesn't have much effect on stream quality correlating with the lack of discussion and/or mention to its options in guides. animation can be used with low bitrate streams to increase Deblocking and film can be used with high bitrate streams to keep the stream as faithful as possible to the source. Although how effective the deblocking or lack of I am not sure.

PSNR and SSIM are for testing and comparison purposes between rate control (CBR,ABR,VBR,CRF).

slhck
  • 223,558
  • 70
  • 607
  • 592
Trr1ppy
  • 25
  • 1
  • 1
  • 5