1. Got a question or need help troubleshooting? Post to the troubleshooting forum or Search the forums!

Partially Working: YouTube Live Stream directly from your Robo R2

Discussion in 'Projects' started by WheresWaldo, Mar 3, 2018.

  1. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    Not currently working as described.
    Started an issue with the plugin creator and his specific response was it wasn't designed for use with rPi camera and avconv so stuff would have to be rewritten. I can get it to stream outside of OctoPrint but it is inconsistent. will keep working on this.

    This is a work in progress so please report if there are issues with your setup.

    You will need a few things first. A verified YouTube account, Live Streaming set up and the ability to ssh into your R2 to run a few commands.

    Note that live streaming uses a lot of upload bandwidth from your ISP. If you care trying to do this on dial-up (yes here are still a few left) or you are using a cellular connection the streaming will be choppy or it may fail during the stream. It also demands a lot of computer resources from your RoboR2 (actually the embedded RaspberryPi 3, which is also running RoboOS and the touchscreen). There is no guarantee that this will be a satisfactory solution if you are thinking about live streaming all your 3D printing.
     
    #1 WheresWaldo, Mar 3, 2018
    Last edited: Mar 4, 2018
  2. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    YouTube Setup

    Go to YouTube.com and either set up an account or go to your account settings. Once you are logged into your YouTube account you will need to click on your account icon in the upper right corner of the YT page.

    [​IMG]

    Select settings and when you are at your account overview there will be a link to Advanced next to your icon. In the Advanced screen there will be an entry called YouTube Channel ID, it will be in the form of UCxx_xxxxxxxxxxxxxxxxxxx. Copy this ID down somewhere or paste it into a text document, you will need it later.

    While you are still on your YouTube page you will need a bit of information from the Creator Studio Live Streaming Dashboard. Under the Encoder Setup there is a masked value called Stream Name/Key. Do not post this anywhere or share it with anyone (all who have this secret key can upload live streams to your account). there is a Reveal button so you can see it for yourself. press it and copy or note the actual key value. It will be in the format of xxxx-xxxx-xxxx-xxxx.

    Right now that is all you need to know from YouTube.
     
    #2 WheresWaldo, Mar 3, 2018
    Last edited: Mar 3, 2018
  3. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    Robo R2 RaspberryPi Setup

    You will need to ssh into your Robo R2 RaspberryPi to perform the next steps. At the ssh terminal you will need to enter the following commands at the command line prompt

    Install docker
    Code:
    curl -sSL https://get.docker.com | sh
    sudo usermod pi -aG docker
    sudo reboot
    Pull Docker Image
    Code:
    docker pull alexellis2/streaming:17-5-2017
    Clone Repository and Rebuild
    Code:
    cd ~
    git clone https://github.com/jneilliii/youtubelive --depth 1
    cd youtubelive
    docker build -t octoprint/youtubelive . 
    Test

    Set up your stream on the YouTube Live Dashboard and enter your stream id in the command below in place of xxxx-xxxx-xxxx-xxxx. Also replace <local R2 IP address> with the actual IP address for your printer.
    Code:
    docker run --privileged --name YouTubeLive -ti octoprint/youtubelive:latest http://<local R2 IP address:8080/?action=stream xxxx-xxxx-xxxx-xxxx null

    Stream should go live and re-encode the OctoPrint stream to YouTube. Once verified close ffmpeg and remove docker container.
    Code:
    ctrl+c
    docker rm YouTubeLive
     
    #3 WheresWaldo, Mar 3, 2018
    Last edited: Mar 3, 2018
  4. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    RoBo R2 OctoPrint Setup

    In the OctoPrint settings go to Webcam & Timelapse and change your Stream URL as follows, remember to replace <local R2 IP address> with the actual IP address for your printer:
    Code:
    http://<local R2 IP address>:8080/?action=stream
    You want this address to be fully qualified or else there will be issues with the stream or it won't stream at all.

    Install the OctoPrint-YouTubeLive plugin with the OctoPrint Plugin Manager. Use the
    Get More... button on the bottom and scroll to the correct option then select install. Once installed OctoPrint will ask you to restart.

    Once back up and running, go back to OctoPrint Settings and select YouTube Live which should be listed in your Plugins section. Now recalling the YouTube Channel ID and the YouTube Stream ID enter those into the appropriate sections.

    Restart your Robo R2 printer.
     
    #4 WheresWaldo, Mar 3, 2018
    Last edited: Mar 3, 2018
  5. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    Still more stuff
     
  6. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    Miscellaneous thoughts

    Author of the plugin specifically told me this is for USB cameras and not the RaspberryPi camera module. I am looking at other solutions.
     
    #6 WheresWaldo, Mar 3, 2018
    Last edited: Mar 4, 2018
  7. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    Exploring another route to get streaming to happen. Debian on which Raspbian is based on forked away from ffmpeg to use libav and avconv. This ffmpeg replacement is probably about 99% compatible with ffmpeg. It is that 1 % that causes issues with YouTube Live. Downloading and compiling ffmpeg for the rPi is about a two hour process. This is where I am at the moment.
     
  8. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    After compiling FFmpeg on the rPi, I can get it to stream from the SSH command prompt. There is about a 10 second delay between starting the stream and it actually showing up on YouTube. There does not appear to be any slowdown in print speed. I am streaming a print of deprime now.



    This is a 720p stream at about 30 fps.

    An unexpected feature, the live stream also appears on the RoboLCD screen. The problem with that is you cannot control the printer from the LCD while you are streaming.
     
    #8 WheresWaldo, Mar 4, 2018
    Last edited: Mar 4, 2018
    mark tomlinson likes this.

Share This Page