Friday, April 15, 2022

StreamPi - Build your own Stream Deck!

 

If you are a streamer, having a configurable stream deck to control your video and audio feeds is almost a necessity. Even if you don't stream online, a stream deck can be a handy device.  But commercial versions are expensive.  Instead of spending hundreds of dollars, you can create you own with a Raspberry Pi and maybe even some devices you already have around the house.


Experienced YouTube, Twitch and other online streamers probably already know this... there are a lot of moving parts during a live stream.  This is especially true if you are using multiple cameras, sharing your desktop, managing chat and more.  And if you have done this a time or two, you probably know how helpful a stream deck can be.

But even if you don't stream, a stream deck can still be valuable add-on for your PC or Mac.  Do you constantly launch the same apps over and over or perform the same task repeatedly?  A stream deck can make that process much easier.  Manage and play music, open any application.. even create a 'canned' email response and execute it at a touch of a button (maybe your keyboard has a handful of buttons like this... maybe to control media... this is the same concept, but much more powerful and configurable).

Commercial versions are available.... the most common being the versions by Elgato (https://www.elgato.com/en).  While these are very nice, professional devices, they are also expensive... running between $150 and $250 (at time of publishing).  Maybe you aren't quite at the level of streaming yet, or just want some extra buttons for your existing home setup, to spend that sort of money.

If you have a Raspberry Pi and a touch screen, or even a spare Android tablet or phone, you can create your own version that duplicates most all of the functions of the pro versions... for little to no cost!

This article is a companion to my YouTube video that shows a full walk-thru of most of the information provided below if you'd rather see this in a video format.

A basic 'keyboard emulator' version


Before I get into the build of a full stream deck, if you are at the point that you only need a handful of buttons that emulate a keypress on your keyboard... for example switching between scenes in OBS or sending something like an F10 command to your computer, there is a basic version that can be created with a 3D printer and less than $20 in parts:


This is what I started out using.  I won't be covering the build of this device, which uses and Arduino Pro micro and connects to your computer via USB, but if you are interested this this version, the creator Dave Madison has a great step-by-step guide over at his blog Parts Not Included.

However, if like me, you outgrow this version and need more buttons and flexibility, you can then consider building a more robust version using Stream-Pi.

Parts List


This version will use a Raspberry Pi and a Pi Touchscreen as an interface.  But note that the Stream-Pi has client applications for a number of other platforms, including Android (phones or tablets), Windows, Linux and MacOS.  If you are going to build the Raspberry Pi version I show below, you will need the following:

(Note: Due to chip shortages and issues with supply chains, Raspberry Pis are in very limited supply at the time of this blog publication.  The link provided below may show 'unavailable' and you may have to scour other online sources to find a Pi in stock).

Item

Notes

Raspberry Pi (3 or better)

Stream-Pi not supported on Pi 0 or 1

32 GB Micro SD Card

Minimum of 8 GB required – Class 10 or better.

5V 3A Micro USB power supply

3A minimum. Normal 2.5A Pi supply won’t work.

7” RPi Touch Screen

 

 

 


The above links may be Amazon affiliate links.  While it will not impact your pricing, as an Amazon affiliate, this blog may earn a small commission if you make a purchase.

You can use a Raspberry Pi 4 as well, but note that ARMv6 processors, which are used in the Pi Zero and Pi 1 are not supported.  You may be able to get Pi starter kits that include a power supply and microSD card at a lower cost than the individual items.  

Preparing the Raspberry Pi


I'm not going to cover the complete setup and installation of the Raspberry Pi operating system.  There are plenty of online guides, including at the official Raspberry Pi site on how to install the operating system and configure the Pi.  However, I will add a couple of quick tips here that will assure that the Stream-Pi client software installs and works.

1. Install and use the Raspberry Pi Imager from the official Raspberry Pi site.  Just install the version for your operating system of choice (Windows, Mac or Linux).

2. When using the imager, select the full Raspberry Pi OS (32-bit):


(the Lite version is missing some of the graphics libraries required for Stream-Pi and won't work without a lot of manual installation steps)

3. Click the 'gear' icon and provide a unique name for this client.  I'd recommend that you also enable SSH for remote access.  Otherwise, you'll need to temporarily connect a USB keyboard to enter the commands to install the Stream-Pi client later.


Scroll down and enter a password, your wifi information and set the localization settings.

4. Write the image to the microSD card, eject from the computer and install in the Raspberry Pi.

5. Follow the manufacturer's instructions for connecting the Pi to the touch screen and mounting in the case.

Installing the Stream-Pi Server


Before installing the client side of Stream-Pi, you'll need to setup the server.  The server is installed on the machine you wish to control with the client... basically, the machine running OBS if that is the intent of your stream deck.  This is currently a  two-step process.

Step 1 - Install the OBS Websocket API

For Stream-Pi to interface with OBS, a websocket utility must be installed.  If you are an experienced OBS users, you may have already installed this and can skip this step.  Otherwise, to the OBS Project Web Socket Github page, select the releases and download the latest for your particular platform (Windows, Mac or Linux).  Install on your machine as you would any other application.

You will be required to setup a password for the websocket connection in both the configuration and within OBS.  Be sure these passwords match.

Step 2 - Install the Stream-Pi Server Software

Go to the main Stream-Pi web site. Select 'Download The Latest':



Then select 'Server Releases':


This will again take you to a Github page.  Locate the installer for you operating system and download it.  Note any special conditions related to your operating system listed on this page, then install the server software.

After installation, the server should automatically start.  If it doesn't, just click the desktop icon to launch it.  The main server screen should appear:


Leave this screen open and move on with the client installation.

Install the Stream-Pi Client


Once again, go to the main Stream-Pi web site and select 'Download The Lastest' as you did for the server above.  But this time, select 'Client Releases' and it will take you to the Github client releases.

The rest of this section covers installation of the client on a Raspberry Pi.  But note that you aren't limited to just a Raspberry Pi.  Client versions also exist for Android (so you can install on an Android tablet or phone), Windows, Linux and MacOS.  If you are installing on one of these other clients, download and install the provided files from the Github repo, again noting any special instructions for your operating system.

For the Raspberry Pi, the installation is done by issuing a command from the command line on the Pi.  This is where you'll either need to remote/SSH into the Raspberry Pi with a utility like PuTTY or temporarily connect a USB keyboard to the Pi.  I'll list the command to copy/paste into the Pi's command line here, but I recommend that you actually copy the command from the Github release page, as it might change after this article is published:

curl -sSL https://install.stream-pi.com/client/raspberry-pi | bash

Let the installation complete and you will be prompted to reboot the Raspberry Pi.  When the reboot completes, the Stream-Pi icon should be on your desktop.  Double-tap to launch.

The first time the client runs, you'll have to complete some basic information, including the server info that the client will use.


Give this client a nickname that will distinguish it from any other clients on your network.

Then enter the IP address of the server and the port number (default of 6504) that you entered when setting up the server.  Click confirm and the client setup is complete and will show a single button on the display as a starting point:


(Both the client and server can be set to either light or dark mode display via the settings/gear icon.  Dark mode will be shown in the photos from this point on).


Creating an Initial Client Profile


What are profiles?
A client can have multiple profiles defined.  A profile is a set of buttons, commands and other options available on the client.  For example, you may setup one profile with buttons and commands laid out specifically for live streaming.  Another profile might contain a different set of buttons or layouts for recording or daily PC use.  Or you might even have different users of the stream deck and each can have his/her own buttons via different profiles.

As soon as you configure the client, it will show up as an available option on the server side:


Select the client name that you just defined from the dropdown.  If you have more than one client on the network, select the one you wish to work with or edit.

You will then be asked to select the profile for that client:


However, if this is the first time this client has been used, no profiles will exist.  You must define at least one default profile for the client.  To setup a profile, click the small gear icon in the lower left corner of the server software.

On the settings screen, select the 'Client' tab:


The client should be shown and you can change the client's nickname, set a default light or dark theme and once you have defined more than one profile, select the profile that will be selected by default when the client starts.

But to add the first (or an additional) profile, click the Add new Profile button.

Name: Give this profile a meaningful name.  The first profile will be automatically named "Default Profile", but you can change it.

Rows and Columns: This is the number of 'buttons' or command boxes to be displayed on each page of the client.  This is not the total number of buttons you can defined, as you can add "folders" or additional pages as we will see later.  You may need to play with these settings to get the best display for your particular client and use.

Action Size and Gap: This defines the area or size of the 'action' part of the button and the non-action or 'gap' between buttons.  If you find that a button is activated when you meant to activate the neighbor button, you can adjust these values.  Normally the defaults are fine.

Hit the 'Save' button when done.  As soon as you hit 'Save' the client will immediately update to show the new number of rows and columns you defined:


Again, adjust the rows and columns until you are happy with the size and layout of the buttons.  When finished, click the 'Close' button on the server setup.  

Now you can select the client and the newly defined profile on the server side.  The server side will then also display the same number of rows and columns as the client.


At this point, everything is configured and you are ready to start adding buttons and commands to your new stream deck client!


Adding and Configuring Buttons and Commands


Commands are added on the server side, but it is convenient to have the client running and viewable as you do this.  As soon as you make a change on the server side, it will show up on the client immediately.  So, having the client available allows you to see the changes as you make them.

To add a new command or action, just select the desired item from the lists on the right hand side of the server software.  Simply drag and drop it to the desired button (it can be any button... you don't have to define buttons from top to bottom or left to right.  You can skip buttons or even leave a whole row or column blank if you like).

As an example, we will add a button that selects a particular scene in OBS.  For testing, you'll want to launch OBS and have it running as well.

To start, simply drop down the OBS list on the right to see the commands.  Drag and drop the 'Set Current Scene' command to any desired button position:


As soon as you do this, you'll see the client update and a new set of command options will appear under the display on the server:


Display Name: This is the text that will show on the button.  If you are going to specify an icon, you can opt to hide this text.  You must have either a display name or icon selected to show (you can also have both... see below).

Display Text Color: You can select a color for the displayed text.

Alignment: Select whether to display the text at the top, center or bottom of the button.

Background Color: Set a background color for the button.  The default is transparent.

Icon: If you wish to display an icon in place of, or in addition to, the display name, select the icon file from your computer.  Icons should be square and between 75 x 75 and 100 x 100 pixels for best results.  You can also hide or clear the icon.

Delay before running: If you want or need to implement a delay between the time you push the button and when the command is executed, you can enter a value here.  The time is in miliseconds, so a value of 1000 would implement a 1 second delay.

Scene Name: This is the name of the scene as defined in OBS.  This must match EXACTLY as entered in OBS Studio:

Scenes in OBS Studio

If your command doesn't work, double-check that the command in the Stream-Pi server matches the scene (or source or other item as appropriate) in OBS.

Auto Connect if not connected: If the server is not connected to OBS when the command is executed, it will attempt to connect if this option is enabled.  You normally want to leave this option enabled unless you have a special-use case.

As soon as you click save, both the server and client will immediately update with the new button and you can immediately test it (assuming OBS is running in this case).  The above settings create buttons that looks like these:

Display name only, icon only and both

Note: The above commands are for the 'Set Current Scene' option.  Each command will have its own set of parameters.  Most should be apparent, but here are a few additional notes:

Toggle Commands:

Toggle commands are used to turn something off or on... like recording or streaming, or a microphone mute option.  Toggle commands generally offer two icon options... and icon for the 'On' state and an icon for the 'Off' state:


This allows you to use a single button that will show the current state of the toggle (off or on):
Single button that changes icon based on on/off state

Other commands and actions:

There are too many options and actions to cover here, including interfaces for Twitter and Twitch.  But most work similar to the above.  There are also numerous commands under 'Essentials' that allow you to control the PC where the server is running, including launching and application, launching a web site, sending a block of text, sending a keyboard macro and more:



Adding a New Page (Folder)


There is one additional feature worth mentioning.  You aren't limited to just one page of buttons or actions.  Under the Stream-Pi Plugins, you can drag and drop a folder onto one of your buttons to create an entire new page:



Now, when you select this 'Folder' action, it will open up a whole new page where you can add additional commands or actions.  A 'Return to previous page' icon is automatically added to the first button position:


You can even add another to this folder to create nested pages, or separate folders to the main page to add multiple pages from there.

Conclusions


While Stream-Pi isn't quite as robust (yet!) as the commercial version and doesn't (yet!) have as many interfaces, the developer appears to be committed to adding additional plugins and features in the future.  And remember, you don't have to use a Raspberry Pi/Touch screen as a client.  An old Android tablet or phone, or an extra laptop can be a client as well.  So, if you have a spare device, you can likely do this at no cost and create a very capable stream deck or set of macro buttons/controls for your computer as opposed to spending the $150-$250 for the commercial version.

Links


Basic Keyboard Emulator Version (Parts Not Included Site)


Supporting the Blog and YouTube Channel


If you'd like to help support this blog and my corresponding YouTube channel for future projects, you can use any of my Amazon links at no cost to you, or you can say thanks and:




No comments:

Post a Comment

To help eliminate spam and to keep all conversations civil, submitted comments are moderated. Therefore your post may not show up immediately. Please be patient as most reviews are completed within a few hours.