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: 67
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: 6,242
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: 67
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,312
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: 6,242
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: 67
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: 6,242
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: 67
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: 6,242
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: 35
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: 2,401
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 Instant Video

My Compression Book

Amazon Instant Video is hiring! PM me if you're interested.
benwaggoner 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 17:14.


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