In my last two blog entries I have discussed how you can stream video from embedded Linux devices such as the Beaglebone using FFMPEG/AVCONV, the V4L2 Capture program and the Logitech C920 USB Camera (with hardware MPEG4/H264). In these setups I am using the regular VLC player to receive and display the video streams (RTP, UDP unicast and UDP multicast). These posts are available here:

I would advise that you read those posts first as I am building on them in this post.

The problem with these solutions is that they are using VLC to display the video and you are effectively without any type of control of the application. For example, If you wished to build a robot navigation system that streams video to the control panel then it would not be possible to modify the VLC user interface very easily.

So this post covers the area of building your own application to view the video streams. You could try and do this from first principles, but that is much too big a task; instead, you are better building on what is currently available.

Step 1: VLC using LibVLC

LibVLC is an incredibly comprehensive and accessible code library for all of the features that are present in the cross-platform VLC multimedia player. It would be great if we can take advantage of this library as it includes all of code necessary to decode video streams, deal with network sockets etc. And we can! The description of the functionality available in LibVLC is available here: You can even download the source code for VLC itself from:

Step 1: Download the version of LibVLC for your platform. To make life easy I would recommend using the pre-built versions. My platform for this post is 64-bit Windows 7 and I am using the tarball for Windows x64 (the latest version at the time of writing is version 2.0.7): I downloaded and extracted the Windows x64 tarball to a directory C:\Qt\vlc-2.0.7 in my case. You can go back a few levels on that URL to check if there are more recent versions and to find the version for your platform.

 Step 2: Use a LibVLC Wrapper

The great thing about open source is that someone has probably tried to do what you are looking to do before and has written some code. The downside is often that solutions are not well packaged and often need customisation to work with recent libraries.

There are several examples on how to use LibVLC within C++ and there are also several wrappers that are available for C++ to help make this process easier. I have tried several, but had particular success with these two:

The reason I selected both of these is that I was able to download the source code for both and was able to recompile them from source under Windows. I’m not sure how useful the first link is under Linux as it is set up for Visual Studio, but the second link uses Qt which means it should be fine under all platforms.

For this reason and because I really, really like Qt as an extension to C++, giving multi-platform user-interfaces, threads, sockets, etc. And, it is freely available. For more information on Qt – see this link.

Step 2: Download the vlc-qt library – I downloaded the “Official VLC-Qt Windows SDK and Source Packages”, which involved clicking the big green box. I extracted this to a folder in my c:\Qt directory called libvlc-qt. So, the directory looks like:

 Step 3 – Make a few changes to the Demo Project

So, in this folder we now have all of the libraries that are needed for the Qt project. You can see in the lib folder the .dll.a files that are the import libraries that are needed. And, for example, libvlc-qt.dll.a is recognized as a library called vlc-qt by gcc (used by QtCreator in my case).

So, within the folder C:\Qt\libvlc-qt\src\examples\ there is a folder called demo-player, which I am going to use for the rest of this example. Opening this within QtCreator gives the following output as displayed in Figure 1.


 Figure 1. The demo-player project open in QtCreator 2.7.2 (Qt 5.1.0 32-bit)

Modify the file slightly as follows:

  • Add widgets to the Qt modules (line 4), so that we use the gui component form of Qt5.
  • Edit the last two lines to direct LIBS and the INCLUDEPATH to fine the libaries and headers for libvlc-qt. My libvlc-qt folder is c:\Qt\libvlc-qt\

Modify the headers of the .cpp and .h files to remove the sub-directory on the includes. So, my adapted source files look like this:




 Step 4 – Set up your Qt Build Kit

QtCreator allows you to easily switch between different “kits”, which are different compilers and compiler configurations. This is particularly useful for cross-compilation where you can compile applications directly for the Beaglebone. I covered this in my video series on Qt and the Beaglebone.

For this compilation I am using the “Desktop Qt5.1.0 MinGW 32bit” kit, which you can select through the “Build & Run” set in the Options pane. You can see my configuration in Figure 2.


Figure 2. Selecting the QtCreator kit.

QtCreator has some very nice IDE features, such as editing the user interface (See Figure 3). If you click on the DemoPlayer.ui (under forms in the project) you will get the forms editor, which allows you to make minor modifications to the project in order to check that you have achieved a custom build. In my case I am going to change the frame title to “Beaglebone Video Streamer”. Save all changes after the minor edit (File – Save all).


Figure 3. Editing the GUI within QtCreator

Finally, I press the button on the bottom left-hand side (I think it is a hammer) and as you can see in Figure 4. I am achieving a successful compilation. Note, it will not run yet! See Step 5.


Figure 4. A Successful Compilation

Step 5 – Ensuring all Libraries are Present and Accessible

My build directory is: C:\Qt\libvlc-qt\src\examples\build-demo-player-Desktop_Qt_5_1_0_MinGW_32bit-Debug which is the default build directory for this project when working from my base directory. At this point you should have a successful build, but it is unlikely that your application will run unless you have made all of the run time dlls available (under Windows) for your application. The best way to do this is to make sure you add all of the required dlls to your path so that they can be found on execution. I have a hybrid setup for this project and there are good reasons for this that I don’t want to go into here.

So, what I have used is as follows:

– Add the path to my MinGW executables and dlls to my PATH environment variable. So to do this I went to Start -> Control Panel\System and Security\System -> “Advanced system settings” -> Environment Variables and then under “System variables” I added C:\Qt\5.1.0\mingw48_32\bin to the end of the variable value, as illustrated in Figure 5. You can add the other directories to your path here, but I am going to just place the dlls in the build folder.


Figure 5. Setting the Windows Environment Variable PATH

My build folder is c:\Qt\libvlc-qt\src\examples\build-demo-player-Desktop_Qt_5_1_0_MinGW_32bit-Debug\src\debug:

– Copy the libvlc-qt-widgets.dll and libvlc-qt.dll files from the directory C:\Qt\libvlc-qt\bin into the build folder.

– Copy the libraries and plugins directory from your vlc download into the build folder (axvlc.dll, libvlc.dll, libvlccore.dll and npvlc.dll). The plugins folder is very important as it contains further dlls that are used by your build. I copied these from my folder C:\Qt\vlc-2.0.7 which I discussed in Step 1.

My build folder now looks like this:

Step 6 – Build and Run!

Okay, after this you should now have an executing version of the demo-player project within QtCreator. Simply press the green play button on the bottom left. My output is captured in Figure 6.


 Figure 6. Running the Application

 In my case everything is working fine. The application GUI appears and I can press the Open URL button. You can see that the window now has the title “Beaglebone Video Streamer”.

The output from the Application Output Pane is:

And it is possible for me to connect to my RTP video stream using the Open Local File button and to my UDP (Unicast or Multicast) streams using Open URL. So, in Figure 7 I connect to my unicast UDP stream (see previous posts) by entering the address: udp://@:1234 into the “Open URL” pop-up dialog box.



Figure 7. The Final Running Beaglebone Video Streamer

So, that is it. I have just added a high-resolution capture of my application running almost full screen and streaming live video at 30 frames per second in Figure 8.


Figure 8. The high-resolution output – running at 30 frames per second.

 I will have a video soon available of my blog series on streaming video in place soon. When it is I will link everything together.