So you read Part 1 of the Remote Recording & Streaming Solution and went out and got all your Raspberry Pi goodies purchased. You’ve got them all plugged in and everything powers on, now what? Well, let’s see if I can help you out with that some.

So let’s discuss what the Raspberry Pi is and why it may seem foreign to quite a few of you. The Raspberry Pi is a product of the Raspberry Pi Foundation with the purpose of providing inexpensive computing hardware for children to learn computer sciences on. You know what? I’m not going to write the book on this for you, simply head on over to Raspberry Pi and watch this “What is Raspberry Pi?” video!

So you’re back, and you’re thinking, “That’s all well and good, but what now?”

Raspberry Pi is a small computer, similar in power to many cell phones. Depending upon the software installed, it can have a variety of operating systems. The usual flavor of O/S used is Raspbian, which is a Debian-based Linux system. So yes, to use your Pi, you’ll be playing/learning Linux. Now I could go on for hours, no days, hell… forever about the ins and outs of Linux, and I still consider myself new to Linux. For a long time, and still widely used today, Linux was the backbone of the internet. It’s still the driving software behind many, many servers that power your favorite websites. But I’m not here to give you a Linux lesson, you just want to get your Pi setup and ready to record and/or stream.

When you boot your Pi for the first time, it will boot to the desktop manager (X session). This is like Windows, but different.


Yours won’t have those random files, it will likely just have the trashcan icon. Those files we’ll get to later 😉 There’s a few things to point out, the menu button is similar to the old start button in Windows. It’s your general menu and has links to many of the things you’ll install inside the desktop manager. The thing I want to bring your attention to is the computer screen icon to the right of the menu button. That’s the icon for your “terminal” window. A lot of things can be done through command-line interface, as well as thru gui. I’m going to simply give you CLI commands at this point because… well preference? I actually rarely use the RDP and connect via SSH to my Pi to do what I need.

First and foremost, update your PI.


sudo apt-get update
sudo apt-get upgrade


These will tell your Raspbian to update it’s sources lists. Linux, unlike windows, is maintained through packages focused on specific things. Each source list is called a repository and each repository can have many many packages on it. “apt-get” is a package manager program used in Debian-based systems.The first command tells your Pi to update it’s list, the second tells it to upgrade any packages that need it. It will likely prompt you asking if you want to continue, go ahead and type yes. After a few moments (or many minutes depending on the number of packages needing updates), you’ll be back at your prompt.

The next command will open a CLI based pseudo-GUI for configuration options:

sudo raspi-config


There are a few things you’ll want to address. First is to “Change User Password”, the pi default password is easily known to anyone who has a Pi. Devious individuals could try to gain entry to your Pi when you’re out and about if you have it connected to wifi’s etc.

Update your “Internationalization Options” as well. You’ll want to make sure the Pi knows what country you’re in, as well as setting the proper timezone.

Essential for this project, you’ll want to “Enable Camera”, else why are you reading this??

There are some other options you can adjust and partake in such as Rastrack (a fun/simple tracking website for Raspberry Pi’s), as well as some other basic stuff. Once you’ve got your settings done, go ahead and exit out of raspi-config, then restart your pi with the following:

sudo shutdown -r now

This tells the Pi to shutdown with the restart flag, now. So the pi will reboot, and all should be good and you’re back at your desktop manager. Once again, open the terminal window. Now it’s time to install the nuts and bolts of what you’re going to need for the streaming/recording.


sudo apt-get install xrdp vlc samba gstreamer1.0
sudo apt-get install autoconf automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libraspberrypi-dev

These install a few things. xrdp is awesome, because it allows you to connect via Remote Desktop Protocol (from Windows and other machines) to your Pi and lets you control it just like you were sitting at the pi with keyboard & mouse. VLC is common for a bunch of the audio/video codecs you’ll need, samba for windows network interactions, and gstreamer1.0 for the streaming/recording stuff.

The second line installs some of the normal Linux development tools, as well as some dev packages for pi and gstreamer. This allows you to build the packages/programs you need since they’re currently not a package on a repository anywhere for you to just install with.

Next, you’re going to need to get the source files you need to build the wrapper.

wget -O gst-rpicamsrc.zip https://github.com/thaytan/gst-rpicamsrc/archive/master.zip


This tells Pi to download a file from the web and save it as gst-rpicamsrc.zip. You’re grabbing the source which, once you build it, creates an element for gstreamer to interface with the raspberry pi camera and use it as a source.

Now to unzip/unpack the archive, and get into the building of it. First you’ll unpack it, change to the directory, then the first step in building things in linux is to configure it.


unzip ./gst-rpicamsrc.zip
cd ./gst-rpicamsrc-master
sudo ./autogen.sh --prefix=/usr --libdir=/usr/lib/arm-linux-gnueabihf/

The last line is telling the configure script where to prepare the program to be installed and some libraries to include.

Then you build the files with:

sudo make

Then you do the final install of the files you built

sudo make install

If all goes well and you don’t have some sort of Error at the end of the output, you should be ready to test that you set everything up correctly!

gst-launch-1.0 rpicamsrc bitrate=1000000 ! filesink location=test.mp4

This launches gstreamer using the rpicamsrc element you created, tells it the bitrate, and tells it to save a file in the directory you were in called test.mp4. You should see something like this:


It will run the camera (which should appear on your HDMI output) and save the file test.mp4 until you end it. Let’s do that by sending the interrupt with Ctrl+C:


And now with a quick ls command to list the directory we see our test.mp4 file output:


So there you have it, you’ve now successfully connected all your Raspberry Pi hardware, connected all the bits together, added the gstreamer packages, and should hopefully have successfully ran the test to save/create a video file of the camera input.

In the next blog post, we’ll dive deeper into the gstreamer steps and start actually streaming things live to your favorite rtmp service! Enjoy!

One thought on “Remote Recording Solution (Part 2) – PiCam!”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.