Adding Steamlink to v9.0.0

  • I wanted to try steamlink without reinstalling anything, so after about an hour of screwing around here is how I got it working.

    This only makes changes within /storage/steamlink , nothing else is touched. If you do not have at least a novice understanding of linux shell or don't fully understand the commands here DO NOT ATTEMPT.

    First thing we download the newest Steamlink and extract it (run on rpi)

    Code
    cd /storage
    wget "$(wget -q -O - http://media.steampowered.com/steamlink/rpi/public_build.txt)"
    tar -zxf steamlink-rpi3-1.1.28.72.tar.gz

    Next we need to download the missing libs that aren't included in this or libreelec itself. These commands might work within the rpi itself but I did them on my desktop.

    Code
    curl --header 'Host: director.downloads.raspberrypi.org' --user-agent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0' --header 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' --header 'Accept-Language: en-US,en;q=0.5' --header 'DNT: 1' --header 'Upgrade-Insecure-Requests: 1' 'http://director.downloads.raspberrypi.org/raspbian_full/images/raspbian_full-2018-11-15/2018-11-13-raspbian-stretch-full.zip' --output '2018-11-13-raspbian-stretch-full.zip'
    unzip 2018-11-13-raspbian-stretch-full.zip
    rm -f 2018-11-13-raspbian-stretch-full.zip
    mkdir x
    mount -o loop,ro,offset=50331648 -t ext4 2018-11-13-raspbian-stretch-full.img x
    cd x
    for i in libpng16.so.16 libicui18n.so.57 libicuuc.so.57 libicudata.so.57 libX11-xcb.so.1 libX11.so.6 libXext.so.6 libxcb.so.1 libxkbcommon-x11.so.0 libXau.so.6 libXdmcp.so.6 libxcb-xkb.so.1 libbsd.so.0; do cp "$(find -name $i)" .. ; done
    cd ..
    umount x
    rmdir x

    Now we have extracted all the libs we need from raspbian, next step is to transfer them into steamlink's /lib folder (the hostname will be different for your setup)

    Code
    scp lib* root@rpi3:/storage/steamlink/lib/

    Next we need to install the steamlink udev rules, but udev is readonly, so we just overlay it (run from rpi)

    Code
    mkdir /storage/steamlink/overlay_work
    mount -t overlay overlay -o lowerdir=/lib/udev/rules.d,upperdir=/storage/steamlink/udev/rules.d/,workdir=/storage/steamlink/overlay_work /lib/udev/rules.d
    udevadm trigger

    Now the steamlink.sh that comes with it is not geared for libreelec, so copy this one over it

    External Content pastebin.com
    Content embedded from external sources will not be displayed without your consent.
    Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.

    Now the final step is to stop kodi and start steamlink (run on rpi)

    Code
    systemctl stop kodi
    cd /storage/steamlink && ./steamlink.sh

    and when your done just restart kodi or "reboot"

    Code
    systemctl start kodi

    I am quite impressed how well this works, everything ran smooth as silk. gj Valve!

  • Systemd.mount file to take care of the overlay for you. Still need to create upper and workdir. Save as storage-steamlink-udev-rules.d.mount. Put it in /storage/.config/system.d/. Turn on with systemctl enable storage-steamlink-udev-rules.d.mount.

  • Audio didn't work. I figured it was because I was testing with a linux host but it didn't work in windows either.

    To fix add this to your config.txt

    Code
    mount -o remount,rw /flash
    nano /flash/config.txt
    ### add this then reboot
    dtparam=audio=on

    Then use this new steamlink.sh that does the udev stuff automatically and loads pulseaudio before steamlink

    External Content pastebin.com
    Content embedded from external sources will not be displayed without your consent.
    Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.

    Edited once, last by ToiletSalad (February 22, 2019 at 7:09 AM).

  • Wow just setup this up and thank you so much. It works surprisingly well, just need to figure out a way to launch it from a shortcut in kodi. I assume we could launch a script that would kill Kodi and launch Steamlink. Would still need a reboot to get back in to kodi tho.

    One note, the steps to mount the raspbian image file and extract the library files do not work on librelec, at least they didnt for me. Was quite a pain acutally, I had to fire up a VM, mount it there, extract the files, copy them over to my host and SSH up to my Pi. Anyway below is a link to a zip file with the library files if anyone else is having trouble.

    LibreElec_Steamlink_Libraries

  • Hi, it work really well thanks.

    I try to convert this code to Libreelec :

    GitHub - swetoast/steamlink-launcher: Steamlink launcher for OSMC

    By replacing in steamlink-launcher/addon.py at master · swetoast/steamlink-launcher · GitHub

    Every '/tmp/steamlink-launcher.sh' with '/storage/steamlink/steamlink.sh' in addon.py



    And commenting line 22 : create_files() to """create_files()"""

    

And it did work, I successfully launch Steamlink from Libreelec's Kodi.

    The only problem is that this script also tells OSMC to quit Kodi before launching Steamlink.



    And this doesn't work yet in Libreelec, so the keyboard doesn't work in Steamlink..

    

Apparently the script creates a steamlink-watchdog.sh that check if Steamlink is launched, and if so, start or quit Kodi.



    I don't know how to adapt this steamlink-watchdog.sh to Libreelec.

  • I made a no-frills launcher so people don't have to ssh in to start steamlink. To install download these three files

    addon.py

    External Content pastebin.com
    Content embedded from external sources will not be displayed without your consent.
    Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.

    script.steamlink.service

    External Content pastebin.com
    Content embedded from external sources will not be displayed without your consent.
    Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.

    steamlink_monitor.sh

    External Content pastebin.com
    Content embedded from external sources will not be displayed without your consent.
    Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.

    then run this from the rpi

    Code
    cd /storage
    wget https://github.com/swetoast/steamlink-launcher/releases/download/0.0.4/plugin.program.steamlink-v.0.0.4a.zip
    # install in kodi, disable updating
    # copy addon.py script.steamlink.service steamlink_monitor.sh to /storage/steamlink/
    mv /storage/steamlink/addon.py /storage/.kodi/addons/plugin.program.steamlink/
    chmod +x /storage/steamlink/steamlink_monitor.sh
    ln -s /storage/steamlink/script.steamlink.service /storage/.config/system.d/
    systemctl enable script.steamlink.service
    # reboot and test
  • Steamlink launches and works mostly well. I'm having two issues though:

    1 - Steamlink does not steal focus from Kodi and thus keyboard and remote input still apply to Kodi which is running in the background. Luckily, controller input is detected.

    2 - Steamlink detects my PC and attempts to start streaming from it but it keeps "Connecting to it" forever and never actually connects.

    Any idea on how tackle these issues?

  • For issue number 2, I found out the solution: Starting Steamlink via SSH manually fixes it. Starting it via the Kodi addon causes the issue. No clue why though.

  • Is there any way to get this working for the latest alpha on a Pi 4? Steamlink supports the Pi 4 now, but I wasn't able to get anything to run following the above instructions. The launcher doesn't seem to do anything, and I get a "permission denied" error on steamlink.sh, no matter how I set the permissions.

    Edited once, last by Kampher (July 20, 2019 at 12:44 PM).

  • Hi guys! Thank you for the instructions, I got it working on my PI3 with libreelec 9.2.

    Steamlink launches and works mostly well. I'm having two issues though:

    1 - Steamlink does not steal focus from Kodi and thus keyboard and remote input still apply to Kodi which is running in the background. Luckily, controller input is detected.

    2 - Steamlink detects my PC and attempts to start streaming from it but it keeps "Connecting to it" forever and never actually connects.

    Any idea on how tackle these issues?

    I simplified and fixed the steamlink_monitor.sh script. Now it stops kodi and all input applies to steamlink.

    steamlink_monitor.sh

    External Content pastebin.com
    Content embedded from external sources will not be displayed without your consent.
    Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.

    But I'm still facing the same problem that it won't connect when started from the addon. Starting from ssh works however as you mentioned. As you can see in the monitor script the output is saved to a logfile but I have no idea what's going wrong.

  • Hey Guys saw this thread at work and big ups for using my work, i could accommodate you guys and make it cross platform so you dont have to disable updates, how does that sound ?

    fyi it shouldnt autoupdate since i dont have any repo :)

    Edited 2 times, last by swetoast (September 24, 2019 at 12:34 PM).

  • Hi guys! Thank you for the instructions, I got it working on my PI3 with libreelec 9.2.

    I simplified and fixed the steamlink_monitor.sh script. Now it stops kodi and all input applies to steamlink.

    steamlink_monitor.sh

    External Content pastebin.com
    Content embedded from external sources will not be displayed without your consent.
    Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.

    But I'm still facing the same problem that it won't connect when started from the addon. Starting from ssh works however as you mentioned. As you can see in the monitor script the output is saved to a logfile but I have no idea what's going wrong.

    I'm not seeing how you "fixed" the script.

  • Haven't fired this up in a while and decided to give it a try. Downloaded the newest steamlink-rpi3-1.1.38.90.tar.gz and installed it to a new directory. Also downloaded the newest raspbian 2019-07-10-raspbian-buster-full.img and grabbed the newest libs. For those that care here are the changes for extracting them

    Code
    mount -o loop,ro,offset=276824064 -t ext4 2019-07-10-raspbian-buster-full.img x
    #
    for i in libicui18n.so.63 libicuuc.so.63 libicudata.so.63 libpng16.so.16 libjpeg.so.62 libX11-xcb.so.1 libX11.so.6 libXext.so.6 libxcb.so.1 libxkbcommon-x11.so.0 libXau.so.6 libXdmcp.so.6 libxcb-xkb.so.1 libbsd.so.0; do cp "$(find -name $i)" .. ; done

    for everyone else here are the libs you can simply download and install libs.tar (link is only good for 14 days so someone else mirror it.) md5 is 40cf74d9c93e7e10844616e81fbca391.

    And steamlink.sh needs one trivial change to work again

    Code
    # add this
    export HOME="/storage"
    # above this
    export PATH="$TOP/bin:$PATH"

    and your all good.

  • One other thing to mention, if your audio is fuzzy garbage do this

    Code
    cat /etc/pulse/default.pa | sed 's/^\(load-module module-udev-detect\|load-module module-detect\)/\1 tsched=0/' > /storage/steamlink/pulse_default.pa

    then make this change to steamlink.sh

    Code
    # change this
    pulseaudio -D
    # to this
    pulseaudio -D -n -F "$TOP/pulse_default.pa"

    this was tested with the newest version steamlink-rpi3-1.1.39.91.tar.gz