Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th December 2017, 20:30   #1  |  Link
ShogoXT
Registered User
 
Join Date: Dec 2011
Posts: 95
Optimal x264 online streaming settings

Hi guys I have been streaming to twitch more since I got my Ryzen rig built, and it is really made for this stuff. I am using OBS.

Im determined to try to make 1080p60 to work if I can, and currently use preset fast/faster at 7000 bitrate. I have 10mb upload so thats probably close to as fast as I can support while gaming.

I was wondering if people had some recommended x264 settings and commands that might help retain more quality in fast moving situations (less washout)?

Mostly I have been messing with threads and bframes. Twitch and Youtube dont seem to like bframes very much as when I change it to 5, it causes stuttering during playback.

I would also like to find the ideal threads setting to help with gaming. Currently using Ryzen 1700 8c/16t so threads should be around 24 at default, correct? I have been using 10-14 because I wanted to decrease the performance impact in games such as PUBG. I suppose my problem is I dont know how important queued threads are to performance. As well I can try disabling HT as when I looked at old Doom9 threads, it seems to have mixed results with that.

Il be taking the time to test each setting on my stream so if anyone knows settings to try out (trellis? b-adapt? etc...) please let me know.
ShogoXT is offline   Reply With Quote
Old 8th December 2017, 22:40   #2  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,806
If I was you I would set High Priority to PUBG executable and left number of threads in x264 as auto detect. If you have very good GPU then I would also enable 60fps lock in game. This should additionally reduce load on CPU.

Quote:
As well I can try disabling HT as when I looked at old Doom9 threads, it seems to have mixed results with that.
Never disable SMT on Ryzens. You will be loosing a lot of performance!

Last edited by Atak_Snajpera; 8th December 2017 at 22:51.
Atak_Snajpera is offline   Reply With Quote
Old 10th December 2017, 00:37   #3  |  Link
ShogoXT
Registered User
 
Join Date: Dec 2011
Posts: 95
You were right about threads command not being very helpful. In previous patches of PUBG this wasnt the case, but now messing with threads even at differing values (10-14) make it worse than leaving it default. They probably changed how the game threading works.

I did some testing and found a few commands of interest.
level=5.1 bframes=5 bitrate=8000 ratetol=0.02

Previously when we used 8000 bitrate, in high intensity scenes the bitrate would jump up to 9500+ bitrate because of the buffering and just eat what little upload speed we had available.

The OBS built in buffering options didnt seem to do much.
Ratetol seems to have fixed the problem completely.

As well high bframe options before didnt seem to work much until I started to set the level option manually. I checked to make sure it was playable on my low end android phone, and it will plays fine. Unlike 10bit hevc .

Faster preset seems to be the edge of what I can do though before it starts dropping frames. Fast and normal presets quickly drop tons of frames.

I play at 4k, which is why i wanted to use 1080p for scaling. Even on 1080p60 it doesnt really look THAT bad, its just the foliage that tends to ruin it. SOOOO I did lots of testing running in foliage.

TESTS SO FAR:
900p60 7000
https://www.twitch.tv/videos/208207429
900p60 8000 with changes
https://www.twitch.tv/videos/208201620
1080p60 7000
https://www.twitch.tv/videos/208204333
1080p60 8000 with changes
https://www.twitch.tv/videos/208199332

Lots of ugly foliage... I will keep testing!

Thanks!

EDIT: Forgot to mention I did play with process affinity settings and the results were less than ideal. Il leave both on normal while testing on the PUBG test server.

Last edited by ShogoXT; 10th December 2017 at 00:41.
ShogoXT is offline   Reply With Quote
Old 10th December 2017, 03:17   #4  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
I'd really suggest using your GPU to do the encoding when you're gaming... Unless you really don't mind / notice the performance hit from x264 using cores.

Then again... Ryzen has cores to spare
Blue_MiSfit is offline   Reply With Quote
Old 10th December 2017, 13:52   #5  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,806
Quote:
I'd really suggest using your GPU to do the encoding when you're gaming...
He would end up with even worse quality than using fast preset in x264.

Quote:
I play at 4k, which is why i wanted to use 1080p for scaling. Even on 1080p60 it doesnt really look THAT bad, its just the foliage that tends to ruin it. SOOOO I did lots of testing running in foliage.
Do you really need 60fps? I doubt that you have stable 60fps at 3840x2160 in PUBG. That game has no optimization I think that for stream viewer 1080@30fps with lower amount of compression artefacts is better than ~60 fps with dancing macroblocks everywhere.

Last edited by Atak_Snajpera; 10th December 2017 at 13:59.
Atak_Snajpera is offline   Reply With Quote
Old 12th December 2017, 03:03   #6  |  Link
ShogoXT
Registered User
 
Join Date: Dec 2011
Posts: 95
Quote:
Originally Posted by Atak_Snajpera View Post
He would end up with even worse quality than using fast preset in x264.


Do you really need 60fps? I doubt that you have stable 60fps at 3840x2160 in PUBG. That game has no optimization I think that for stream viewer 1080@30fps with lower amount of compression artefacts is better than ~60 fps with dancing macroblocks everywhere.
That is very true and I agree about the 30vs60 fps issue, but people kind of expect 60 fps for game streams now. So I have to try to make it work.

Faster preset animation tune level=5.1 bframes=5 bitrate=8000 ratetol=0.02
These are the settings I have been using the past 2 days and I feel like its one of the best looking 1080p60 PUBG streams I have seen. Only issue besides foliage macroblocking, which I think animation tune helped a little bit (i wish I could use avisynth filters for quick denoise), is I get some light ghosting when on fast moving roads.

Does high bframes cause it?

Im at like 0.01% frame drops, so I think i can live with it. The game does run like crap, but mostly because of frame drops, despite my FPS showing 50-60. GTX 1080 TI that I bought helps with the 4k.
ShogoXT is offline   Reply With Quote
Old 12th December 2017, 13:13   #7  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,806
Quote:
but people kind of expect 60 fps for game streams now.
PcMasterRace

Quote:
i wish I could use avisynth filters for quick denoise
x264 has built in basic denoiser

Code:
--nr <integer>          Noise reduction [0]

Last edited by Atak_Snajpera; 12th December 2017 at 13:17.
Atak_Snajpera is offline   Reply With Quote
Old 13th December 2017, 21:36   #8  |  Link
ShogoXT
Registered User
 
Join Date: Dec 2011
Posts: 95
Quote:
Originally Posted by Atak_Snajpera View Post
PcMasterRace


x264 has built in basic denoiser

Code:
--nr <integer>          Noise reduction [0]
Ohh I had forgotten about that one!

I was testing it yesterday and I feel like I still need to combine it with Tune Animation to smooth out the macroblocks.

I still have a few dropped frames due to encoder lag. Nothing a bit more overclock cant fix when the new Asrock BIOS comes out.

The last big problem is the bitrate still seems to go up despite of ratetol=0.02 for 8000. I think it might actually have to do more with the twitch servers. I have the best one picked so far I think, but some of the servers cant handle more than 8000. It will be fine for a while, then suddenly choke for 2 seconds.

Considering the fact that I have no game connection problems and discord still works, im inclined to believe its not my 10mb upload.

Il keep working on it.
ShogoXT is offline   Reply With Quote
Old 14th December 2017, 11:09   #9  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,806
Experiment with these settings

Code:
--vbv-bufsize 8000 --vbv-maxrate 8000
Atak_Snajpera is offline   Reply With Quote
Old 14th December 2017, 16:48   #10  |  Link
zub35
Registered User
 
Join Date: Oct 2016
Posts: 56
Example settings in ffmpeg

-c:v libx264 -profile:v high -level 4.2 -preset slow -b:v 6M -maxrate 6M -bufsize 12M -g 180 -nal-hrd cbr -ref 3 -aq-mode 2 -aq-strength 1.2 -psy-rd 1.2:0.5 -f flv rtmp://...

1. for stream only CBR bitrate!
2. bufsize = bitrate*2
3. keyint = fps*3 (3 sec)
4. add "-ref 3" in preset slow-veryslow for to increase the encoding speed.
5. specify level 3.1 (720p30) 3.2 (720p60), 4.1 (1080p30) 4.2 (1080p60) to hardware decode it without problems. No use 5+ levels!
6. add "-nr 500" If you don't use MSAA (antialiasing) in game.

Last edited by zub35; 14th December 2017 at 17:00.
zub35 is offline   Reply With Quote
Old 15th December 2017, 18:41   #11  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
Quote:
Originally Posted by ShogoXT View Post
That is very true and I agree about the 30vs60 fps issue, but people kind of expect 60 fps for game streams now. So I have to try to make it work.

Faster preset animation tune
Is preset animation actually that much help? It was tuned around cel animation, not CGI. But I could see it being helpful with computer game content that doesn't use motion blur, and does use flat colors and sharp edges.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 20th January 2018, 23:17   #12  |  Link
ShogoXT
Registered User
 
Join Date: Dec 2011
Posts: 95
I still have been trying to test settings for the last month.

8000 is the max I can sustain on twitch successfully over time, though I did test nvenc at 9000 and it didn't look too bad. Nvenc doesn't react well to lighting changes though.

If I go from faster to fast, I start losing 5% of frames at most. So I have been trying each setting to see what I can keep.

Rc-lookahead=30 seems to lose the most. I have been using subme=5 because I am having difficulty tweaking psy-rd for the pubg game. Also am using ref=3 at earlier recommendation. Haven't tried mixed-refs yet.

My biggest problem is sometimes in game I will be moving fast in foliage, and it will start macroblocking like crazy. I need to find something that is good for that. Also fences while moving.
ShogoXT is offline   Reply With Quote
Old 27th January 2018, 18:00   #13  |  Link
polarhei
Registered User
 
Join Date: Feb 2015
Posts: 3
Quote:
Originally Posted by ShogoXT View Post
Hi guys I have been streaming to twitch more since I got my Ryzen rig built, and it is really made for this stuff. I am using OBS.

Im determined to try to make 1080p60 to work if I can, and currently use preset fast/faster at 7000 bitrate. I have 10mb upload so thats probably close to as fast as I can support while gaming.

I was wondering if people had some recommended x264 settings and commands that might help retain more quality in fast moving situations (less washout)?

Mostly I have been messing with threads and bframes. Twitch and Youtube dont seem to like bframes very much as when I change it to 5, it causes stuttering during playback.

I would also like to find the ideal threads setting to help with gaming. Currently using Ryzen 1700 8c/16t so threads should be around 24 at default, correct? I have been using 10-14 because I wanted to decrease the performance impact in games such as PUBG. I suppose my problem is I dont know how important queued threads are to performance. As well I can try disabling HT as when I looked at old Doom9 threads, it seems to have mixed results with that.

Il be taking the time to test each setting on my stream so if anyone knows settings to try out (trellis? b-adapt? etc...) please let me know.

Try studying what HDTV has been using, 2 B-frames, 12-14Mbps Mpeg-2,1080I for the pictures.

Of course, For the Streaming, You can do something like that, But the same spec can be performed like 12Mbps,50fps/x264

If with b-frames, you will need 4 (Which is PASCAL GPU can deal with x264) to deal with.
polarhei is offline   Reply With Quote
Old 27th January 2018, 18:37   #14  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,406
Quote:
Originally Posted by ShogoXT View Post
Only issue besides foliage macroblocking, which I think animation tune helped a little bit (i wish I could use avisynth filters for quick denoise)
Instead of tune animation perhaps --deblock 1:1 or even 2:2 would be better, stronger deblocking like tune animation but without the other optimizations for cel animation. Tune film should be good for games, but with deblocking turned up for your bandwidth limited situation.
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:38.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.