Wednesday, October 21, 2015

Removing Steam Link Bandwidth Limit

A reddit thread brought to my attention that there is a bandwidth limit on the steam link. I've finally figured out where the stream settings are saved and how to read / write them.You will also have to make one file called streaming_args.txt, I'll explain below.

streaming_settings.bin This config file has its maximum_bitrate_kbps set to 0. Which signifies no limit.
streaming_settings_100000.bin This config file has its maximum_bitrate_kbps set to 100,000 for 100mbps.

To use these you can either scp them into your /mnt/config/system/ folder as streaming_settings.bin or you can put the file on a USB pendrive as /steamlink/config/system/streaming_settings.bin and reboot with the pendrive inserted. (Note: You need to hard 'reboot' un-plug and re-plug the power, you should see the steamlink on a blue background icon thing.)

To see if it worked goto your Streaming settings and press Y to go into Advanced Settings. If it worked your Bandwidth Limit row will be blank. You can change any other settings but just make sure you don't go left/right and change the setting on the Bandwidth Limit or you'll need to replace the streaming_settings.bin again.

Now to disable the 25mbps hardware encoding limit inside the streaming_client binary you need to create a file called `streaming_args.txt` inside that file put `--hardwarebitratelimit 0` (Note: 0 will disable the limit but you may get black flickering, setting it to 35000 seems to work the best for me) and save it either with scp to /mnt/config/system/ or with a USB drive at /steamlink/config/system/.

Those two changes will allow you to exceed 25mbps bandwidth limit in the hardware encoder. Another interesting thing to play with is in the streaming_args.txt you can specify other arguments. Like --novsync. Below is a full list of the supported arguments that you can put in the streaming_args.txt

--fullscreen
--windowed
--[no]vsync
--[no]hwaccel
--noinput
--scale [1?]
--quality [1-3]
--captureres [WxH]
--framerate [N]
--hardwarebitratelimit [N (Kbit/s)]
--bitrate [N (Kbit/s)]
--burst [N (Kbit/s)]
--debug
--server [IP:PORT]
--settings [PATH]
--showdebugoverlay
--gameid ?

43 comments:

  1. Thanks for trying to figure this out. It doesn't seem to work for me unfortunately. It looks like the streaming_settings.bin is being applied as the Bandwidth Limit options is blank as described, however the streaming_log still shows a limit of 25000, so it looks like the 2nd part of the fix, stream_settings.txt, isn't being applied for some reason. Any ideas?

    ReplyDelete
  2. I'm not sure about the streaming_log, have you tried turning on the debug menu on the Steam Link and checking there? I also have hardware decoding disabled on my host machine as it tends to crash steam. There are so many mixed statements on what's limiting where. From what I've gathered the host PC can limit the output bandwidth if hardware encoding is enabled, there is a config file you can change on the host to fix that. But I've also read that there is a hardcoded limit based on half of your estimated bandwidth.

    One way to test that the steam link isn't the limiting factor is to ssh into the link and do `ps -af | grep -i streaming` in there you can see the command line params being passed to the streaming client. You should see two instances of --hardwarebitratelimit, one is 25000 and the other is whatever you defined in stream_settings.txt. If that is correct then I'd start tinkering with settings on the host PC.

    ReplyDelete
  3. Thanks for the response. It seems that none of the parameters I put in stream_settings.txt are used when streaming_client is started. I think this is where my issue lies, as the hardwarebitratelimit of 25000 is well over half the estimated bandwidth of 30000 so it's not the hardcoded limit.

    I may just have to wait until they fix it properly, but I'll keep messing about and report back if I make any progress.

    ReplyDelete
  4. For what it's worth, I can't it get it to send the stream_settings.txt parameters to streaming_client. Tried both saving the file locally (on /mnt/config/system) and on a usb, but no dice.

    Been a pretty fun road to figure the inner workings though. By the way,how did you get all the parameters that the streaming_client binary accepts? I figured out that it had a help (-h) parameter, but that does not show all the parameters you mentioned. Not to mention how you figured out that it excepted the stream_settings.txt file.

    I could also figure out the enable_ssh file and the build download parts, but those 2 things still have me stumped.

    Thanks! It's always great to read the findings of a fellow tinkerer.

    By the way, there's also a beta channel (media.steampowered.com/steamlink/06_2015/beta_builds.txt)

    ReplyDelete
    Replies
    1. Oh wow you're the first person to point out that typo to me. Its streaming_args.txt not stream_settings.txt.

      As for figuring the internals out you just have to dig into the ELF binaries. gdbserver also exists on the steamlink already so you can easily debug the bins.

      Also I never noticed the beta builds file. I've found the builds though because I just bruteforce the update files (0-999) every day to see if any new ones exists.

      Sorry about the typo though, at least the streaming_settings.bin fix was working, that disables the software limit.

      Delete
  5. Ah, it was a typo. I'll test it tonight, when I'm back from work.

    I have no experience digging through binary and (possibly) symbol files. Seems like a fun new challange. Thanks for the tips! It's so fun discovering the internals of a device like this.

    ReplyDelete
  6. Excellent, can't wait to try this when I get home in a couple of days 😊

    ReplyDelete
  7. This now works perfectly for me. Image quality is noticeably better. Sweet spot for me is between 35000 and 40000, though it does increase the display latency a bit.

    Thanks a lot for taking the time to figure this out, I can enjoy the games now without being constantly niggled by all the artifacts.

    ReplyDelete
  8. I can't seem to get the Bandwidth to show blank under advanced in streaming. I created a folder system on my USB Thumb drive steamlink/config/system/streaming_settings.bin, with steamlink being the first folder. Did I do that correctly? I plug in the USB thumb drive in when the Link is unplugged, plug it back in, leave it in, go to streaming, advanced and it still says "Automatic"

    ReplyDelete
    Replies
    1. Worth mentioning in addition that I know NOTHING of Linux and I'm assuming "scb" means using some sort of linux system to connect to the Link, so thumbdrive is my only hope.

      Thanks!

      Delete
    2. On the root of the pendrive will be a steamlink folder, inside the steamlink folder will be a config folder and inside the config folder will be a system folder. Inside the system folder you will put streaming_settings.bin

      Delete
  9. Thanks for the response, how about the fact that it still shows "Automatic" regardless of me putting in the pendrive?

    ReplyDelete
    Replies
    1. Then its not working. Try a different USB drive and port.

      Delete
    2. Was definitely the thumb drive, it was just an old one. Tried a new one and boom, working. Now if only I could make it look a teensie less fuzzy and washed out...

      Delete
  10. Hi.
    Tried the fix, i get blank in bandwith at advance settings, but the 15000 cap is still there in the logs.....
    I tried yesterday with two usb in two ports....
    Any advice??

    ReplyDelete
  11. something i've noticed is that the first time i followed these instructions the rate limit came up blank as expected. Then i tried changing it to see if the overlay showed any difference in latency/bitrate and the blank option vanished. Now, everytime i do a hard-reboot there is no blank option anymore...

    ReplyDelete
    Replies
    1. oops i missed the bit about not going left or right, i had to replace the .bin file again ...

      Delete
    2. Ah, yea blank means its working. You want it to stay like that.

      Delete
  12. I think today's steam link update might have just made this solution redundant. I can't get the link to load from the usb any more, no matter what I try :(

    shame because this was a great "hack" - could it be adjusted to work again?

    ReplyDelete
    Replies
    1. What do you mean 'load from usb' ?

      What are you trying to do and what is it actually doing.

      Delete
    2. I can confirm that this no longer works after the latest update. There is a new option that says unlimited. It no longer goes blank.

      Delete
    3. Did some further messing around. It seems that I can change the incoming bitrate, but not the bandwidth. Looks like the arguments still work, just not the .bin file. Seems like Valve has allowed up to 100Mbps for the bandwidth on the unlimited setting.

      Delete
    4. Hi Aaron, i meant the .bin file will no longer overwrite the bandwidth settings, although it appears this is less of an issue now anyway as they're releasing updates that affect this setting

      Delete
  13. Any idea how to set maximum_bitrate_kbps in streaming_settings.bin to something other than 0 or 100,000?

    I'm asking because with the new Steam client beta it auto doubles the bitrate when it detects 30FPS content (and on my network) that results in packet and frame loss.

    ReplyDelete
  14. It is possible but I don't know if its the solution you want. Do you have SSH access to your steam link or are you capable of compiling and running a program?

    I would just recommend keeping it on the Beautiful/Automatic settings though.

    ReplyDelete
  15. Yes to both. :)

    I'm on wireless using 39Mbps right now and unfortunately the new Steam beta doubles the bitrate to 79Mbps when it detects a game running at 30FPS.

    I sort of hoped setting maximum_bitrate_kbps to "39000" or "40000" would solve the problem. But I won't know until I test it. ^_^

    ReplyDelete
    Replies
    1. Alright, I actually cant find the old program that I threw together to edit the settings.bin.

      I'll re-create it whenever I get the chance and throw it on github so you can compile and use it yourself.

      If you've ever used protobufs before its pretty straight forward. Just use protod from the protobuf-re-tools and dump the streamsettings.proto and out of streaming_client.bin. Then you can just use protobuf like normal to edit the bin file.

      Delete
  16. As of build 412 it doesn't seem like patching streaming_client.bin is necessary. I did a factory reset and only have streaming_args.txt with hardwarebitratelimit set.

    ^ The new bitrate limit works and I can even switch between the preset limits in the UI without loosing the new max bitrate. -'Unlimited' becomes whatever you set hardwarebitratelimit to.

    Not only that but it appears the streaming_args and update_branch you set will be remembered until the next time a firmware update changes it. Meaning you can set streaming_args, update_branch and then remove the USB stick.


    As for the lag, I reported the bug and Valve was kind enough to pull the performance regression and investigate further: http://steamcommunity.com/groups/SteamClientBeta/discussions/0/494632506576356059/


    Finally although not important anymore I think one of these (in hex) three are correct for 39Mbps in streaming_client.bin:
    08031000180020002800303E9D674001 or
    08031000180020002800304A62F84001 or
    080310001800200028003098584001

    Have a wonderful holiday Aaron and thanks for figuring out how to hack the bandwidth limit.

    -Jason (Quad)

    ReplyDelete
  17. Is there a way to remove the FPS cap being 30 or 60? My PC is SLI and very capable of running valve games at 144 hz. Is that possible with the streaming_args?

    ReplyDelete
    Replies
    1. Let me explain the issue when I'm running steam link it forces my games running on the host computer to be capped at 60 FPS

      Delete
    2. I've noticed that with source engine games. I've never looked into it though, maybe they're just changing the fps_max convar? Also I don't think getting the game FPS higher will do much as I believe the in-home streaming capture service only captures at 60 FPS, I could be wrong though.

      Do note though that the Steam Link is the limiting factor here, not your PC. Even if you get your PC to run high the Link still needs to be able to decode it as fast as possible. Its a tradeoff between quality and latency.

      Delete
    3. No friend I checked the fps_max and entered it again its being locked somewhere else I know for sure not the games. It locks my media player to 30 FPS and my games to 60.The thing is my friends come over we play multiplayer games we like to sit in different spots. I like to use the PC screen he likes to use the TV screen. The issue is the PC screen gets capped to 60 and it looks horrible because its a 144hz monitor. I just want it to be like streaming to twitch where you can stream output 30 FPS but your game still runs higher than that.

      Delete
    4. I see, not sure where its being limited though. Sorry.

      Delete
  18. I record games with the same nvidia encoder at even higher bit rates than what the steam link does and I don't lose any frames and run games like Dota at 145 FPS constant. I can stream to twitch 30 FPS and get 145 FPS in dota but steam link just forces my PC to run at 30/60 depending on what window is present. The mouse literally looks like a flip book. I was thinking it was something to do with that --nogsync argument but every time I enter that argument the link refuses to connect to my computer. I tried the --framerate argument but that only seems to work for the desktop still caps the games at 60.

    ReplyDelete
    Replies
    1. --novsync not gsync that argument refuses to let me steam link launch and run properly.

      Delete
    2. rofl even when I use the button "turn off steamlink or stop steam link" it still keeps my FPS capped at 60 until I physically unplug the steam link wtf man...

      Delete
    3. Can you try the --novsync argument see if your able to get your steam link to work and tell me what FPS your games running at on a game you know you can get like 100+ FPS uncapped

      Delete
    4. I'm at work right now so I can't test. I also run Linux so I'm using the software encoder and no limits here other than in source games.

      Try changing the window mode for the game, fullscreen vs windowed vs windowed borderless. I also recall hearing that Windows 8/10 has some weird issues of forcing frame rate if you have the xbox app installed or even nvidia shadowplay enabled. Windows 8/10 also limits the FPS of the desktop itself to either 30 or 60. Read around on the community discussion as some others have more than likely brought up the same issue.

      Delete
  19. I did try windowed borderless and exclusive fullscreen same 60 FPS cap. My FPS has never been capped using any xbox applications or shadowplay streaming/recording I read everywhere people don't even know about the arguments. This is 100% a steam link setting should be able to change it somehow somewhere just haven't found it. I want to broadcast at 60 FPS but I don't want my games capped to that.

    ReplyDelete
  20. My only guess is that its forcing on vsync

    ReplyDelete
  21. So the vsync command works as long as I don't use the framerate command at the same time. This did not help locking the computer to 60 FPS I believe now something somewhere on the system is forcing the FPS to be locked despite driver or graphic settings of the game.

    ReplyDelete
  22. I can't understand your guide. It's so half-assed.

    ReplyDelete