Thursday, October 3, 2019

Low Latency Streaming from OBS to BrightSign Using SRT

There are a few free video streaming services that support low-latency streaming over the internet, notably Mixer and YouTube ultra-low latency. However if you prefer local streaming (perhaps to conserve bandwidth) or prefer open source, let's take a look at how you can stream from OBS Studio to BrightSign players (not open source) or other devices that support SRT streaming protocol such as VLC.

Edit: OBS supports SRT as of version 25, but I'll leave this post up for historical reasons.

--- 

Hopefully at some point soon OBS will support SRT, but for now we'll need to run a separate application. Assuming that you are already using OBS for streaming to an external destination, we'll use the "recording" feature to send to Haivision's srt-live-transmit application.

There's some work required to compile srt-live-transmit, and I'll admit I haven't gotten it to work on Windows yet, but it's easy on Linux (including Windows Subsystem for Linux) and Mac.

SRT for Mac

Getting SRT on Mac just involves launching the "Terminal" program and running two commands:

brew update
brew install srt

This will install srt-live-transmit at:

/usr/local/Cellar/srt/1.4.0/bin/srt-live-transmit

SRT for Linux or WSL

If you have Ubuntu installed under Windows 10 through Windows Subsystem for Linux, you can run the following commands in the terminal:

sudo apt update
sudo apt upgrade
sudo apt install tclsh pkg-config cmake libssl-dev build-essential git
git clone https://github.com/Haivision/srt.git
cd srt
./configure
make

After the compilation process, you should have:

~/srt/srt-live-transmit

Sending from OBS to srt-live-transmit

From the terminal (on Mac, Linux, or WSL), run the following command:

./srt-live-transmit udp://:1234 srt://:5678 -v

On your Mac you may first need to change to the right directory:
cd /usr/local/Cellar/srt/1.4.0/bin/

That command listens for a UDP stream (that we'll send from OBS) and listens for a request to unicast it as an SRT stream. The -v means verbose mode, which allows us to read what it is doing.

In OBS we need to go into Settings, click on Output, switch the Output Mode to Advanced and click on the Recording tab. Switch the Type to Custom Output (FFmpeg) and the FFmepeg Output Type to Output to URL.

The File path or URL should be set to udp://127.0.0.1:1234?pkt_size=1316 (127.0.0.1 means sending to the same computer that OBS is running on) and the Container Format should be changed to mpegts. I haven't done any testing, but I'm assuming that decreasing the Keyframe interval should decrease latency, and decreasing the Audio Bitrate is probably fine to decrease bandwidth usage.



Click OK, then the Start Recording button. Have a look at the terminal window where srt-live-transmit is running. You should see information about the stream.

Add the SRT source to BrightSign or play it as a network source in VLC (if your sending computer is at 10.0.0.200 then srt://10.0.0.200:5678). You should see your stream that is being transmitted from OBS and relayed by srt-live-transmit.

Hopefully this works for you, feel free to comment if you encounter issues.

Using Git from the Command Line

This post is more for my future self, but others may find it useful. Feel free to comment if I've made any errors or missed anything important.

Assuming that Git is already installed, to start using it with terminal commands we need to set up a couple of things:

git config --global user.email "INSERT_EMAIL_ADDRESS_HERE"
git config --global user.name "MisterHay"
git config --global core.editor nano

It's also a good idea to set up SSH keys.

and then clone the appropriate repository:

git clone https://github.com/callysto/curriculum-notebooks.git

or with ssh:

git clone git@github.com:callysto/curriculum-notebooks.git

and some useful commands:

list branches:
git branch -a

get files from GitHub:
git checkout origin/staging

create branch from staging:
git checkout origin/staging -b NameOfNewBranch

change to branch (if not already there):
git checkout --track origin/NameOfBranch

edit files, then (stage changes):
git add changed_file.ipynb
or
git add ./*

check with:
git status

discard all local changes to all files permanently:
git reset --hard

commit to local:
git commit

push to remote:
git push -u origin NameOfBranch

then create a pull request to staging from that_branch using GitHub.com interface

To see what has been happening, check the top of
git log

Hopefully that's enough to get you (future me back) up to speed.

Wednesday, September 11, 2019

My new job: Callysto Ambassador

Since I haven't written a blog post in a while, perhaps I can talk briefly about my new job. Funding has been officially announced for PIMS and Cybera's CanCode project entitled "Callysto: Building Tomorrow's Digital Leaders". I'm taking a year off from teaching to help with resource development and teacher training for the Callysto project.

Callysto aims to foster computational thinking and data science skills in students and for teachers. There are some curriculum-related notebooks, a Jupyter Hub, online courses (being developed), supports for teacher to develop notebooks, as well as opportunities to offer (call for proposals coming soon) or attend professional learning activities, or participate in educational research.

Everything through the Callysto project is available for free (gratis and libre).

Let us know if you're interested.

Sunday, November 11, 2018

Live Video Broadcasts to Internet and Local Network with RTMP

There are times when we want to stream to the internet (YouTube, Facebook, or some other service), or to the local network, or both. We use OBS Studio for both, so we'll use two RTMP streams.

To stream to an internet service, set up OBS with your streaming key the usual way. There are plenty of tutorials for that, such as this one. The "Start Streaming" button in OBS then allows you to stream to that service.

To stream to computers (and/or digital signage) on the local network though, we use the "Start Recording" button. Run a program called MistServer, either on your OBS computer or on another one. Then in OBS go to Settings, Advanced, Recording and select "Custom Output (FFmpeg)" and "Output to URL". As the File path or URL put  rtmp://ip_address_of_MistServer/live/your_stream_key  and set the container format to flv.

Now the "Start Recording" button starts the stream to your MistServer, and other computers on the local network can watch the stream from http://ip_address_of_MistServer:8080/your_stream_key.webm in Chrome or Firefox.

Sorry if this is a little thin on details, in a future post I'll write more about this setup and how to use Screenly (and balenaCloud) to stream to digital signage.

Monday, October 22, 2018

Live Video Production with Remote Guests

We've had fairly good success with live video announcements, and have started experimenting with live on-location guests.

Our video switcher is OBS Studio, with the NDI Plugin for OBS. NDI (Network Device Interface) is a way of sending live video over a network with very low latency, and it has allowed us to do very cool things.

We use NDI Tools Scan Converter for remote cameras using webcams such as Logitech C920 webcam or Microsoft Lifecam HD 3000, or just the integrated cameras on Windows tablets.

A slides program or ProPresenter together with vMix Desktop Capture for NDI enables "over the shoulder" images, text, and video.

We also create virtual sets for our newsroom using Sketchup and Kykythea or by hand-drawing them, and use motion backgrounds from sites like Vidvo.

But one of the coolest things is that we can now have live video guests from anywhere in the world using Skype for Content Creators. The Skype output shows up as an NDI source that can be added to OBS, and the NDI Tools Virtual Input allows us to send any NDI source to the remote guest.

Soon we'll have on-location reporters using just phones on tripods.

Thursday, September 27, 2018

Technology for Guided Math

I've been doing guided math, and wanted to mention some technology that I've found works well for small-group instruction.

There's an old laptop with OpenBoard installed, connected to a donated 32" TV. We use a Wacom Bamboo pen tablet, but any similar tablet would work. I also like the Windows 10 Ink tools, the Bamboo Paper app, and Microsoft OneNote. We've also experimented with tablet computers or iPads and and rubber styluses, but they don't feel as nice to write and draw with.

I also have a laptop with a spreadsheet for anecdotal notes on student progress. It's angled so that only I can see the screen, and I make sure to take it back to my desk when we're not doing guided math or guided reading.

So it's not anything groundbreaking, but it's technology that's working well for us.

Saturday, July 7, 2018

I've started running

I used to say that I would only run when chased, but my wife signed me up for a 5k race this year and it seems to have stuck. I've been running almost every day, and enjoying it.

Of course there is technology involved.

No smartwatch or fitness tracker bracelet at this point, but I'm tracking progress by running with my phone. My wife introduced me to Runkeeper, which I've been using for every fitness-related run and bike ride. The five-minute audio cues of pace, distance, and time are great. At the recommendation of my brother-in-law I've also starting trying Strava, and the routes feature for challenging others looks cool. If the audio cues are similar to Runkeeper, I may switch to that.

Speaking of audio cues, I've also been loving the Trekz Titanium bone conduction Bluetooth headset. They sound good, but also allow me to hear other things and avoid getting hit by traffic.

I've also realized is that listening to music helps me not to focus on my breathing. My current favorite playlist is Power Music Workout (Amazon Music).

And I now have three different types of running shoes with various levels of cushion. Before buying new shoes, I read up on minimalist running (and decided it was a good enough idea to buy an appropriate pair of shoes, New Balance Minimus). My wife also convinced me to buy some cushy shoes (Asics GEL-Cumulus) and some medium-feeling ones (Nike Flex Run). I even liked my old non-name-brand shoes, but they just suddenly seemed to wear out. It's unlikely that they had 400 km on them though.

Those paragraphs probably started to sound like product recommendations. These are not recommendations, just what I've started using. I'm certainly not getting paid for talking about my opinions, but maybe I should check that Amazon Affiliate thing that people talk about.