This article provides a step-by-step guide on how to build and use GStreamer with Yocto Project and BeagleBone Black, an open-source multimedia framework for building media applications.
Abstract
The article begins by introducing GStreamer, an open-source multimedia framework that simplifies the handling of video and audio. It then explains the scenario of the article, which is to build and use GStreamer with Yocto Project on an ARM hardware architecture, specifically the BeagleBone Black single-board computer. The article provides a detailed guide on how to set up a Yocto Project build environment, source Poky and the necessary layers, create or modify the content of the file 'bblayers.conf' inside the 'conf' subdirectory, check if the layers have been added correctly, modify the content of the file 'conf/local.conf' to specify the features of the Yocto build, and bitbake the Yocto Project Image. The article also provides command-line examples to test-run the ability of GStreamer to run various sorts of multimedia.
Bullet points
GStreamer is an open-source multimedia framework that simplifies the handling of video and audio.
The article provides a step-by-step guide on how to build and use GStreamer with Yocto Project and BeagleBone Black.
The article explains the scenario of the article, which is to build and use GStreamer with Yocto Project on an ARM hardware architecture, specifically the BeagleBone Black single-board computer.
The article provides a detailed guide on how to set up a Yocto Project build environment, source Poky and the necessary layers, create or modify the content of the file 'bblayers.conf' inside the 'conf' subdirectory, check if the layers have been added correctly, modify the content of the file 'conf/local.conf' to specify the features of the Yocto build, and bitbake the Yocto Project Image.
The article also provides command-line examples to test-run the ability of GStreamer to run various sorts of multimedia.
Build and Use GStreamer With Yocto Project and BeagleBone Black
In this article, I am going to walk you through the process of setting up the Yocto Project to fetch the necessary content and build an Embedded Linux distribution supporting the GStreamer framework. Furthermore, I shall provide you with command-line examples to test-run the ability of GStreamer to run various sorts of multimedia.
Introduction
Gstreamer is an open-source multimedia framework that can be used to build all kinds of media applications (e.g. media playback, streaming, editing). The framework is designed to simplify the handling of video and audio or both simultaneously.
GStreamer works on with all major operating systems like Linux, Windows, Android, OS X, iOS. It may run on all major hardware architectures including x86, ARM, MIPS, SPARC.
To achieve its job, GStreamer uses its plug-ins to provide codecs, support for multiple container formats, filters, etc.
In this article, I am going to present the build and use of GStreamer with/in a Yocto Project distribution (Linux for Embedded devices) running on an ARM hardware architecture (namely AM335x — BeagleBone Black)
Read more about BeagleBone Black single-board computer (SBC) here:
The last three addition are good to have. Not necessarily needed, but I recommend adding them for enabling future use-cases.
This is
By the way, this is where the GStreamer finds its place on your machine (it is inside poky.. dir, under meta/recipes-multimedia)
Step 2. Source Poky and the necessary layers to build the GStreamer enabled Yocto distro
$ cd ..
$ source poky_dunfell/oe-init-build-env build_dunfell
Step 3. Create or modify the content of the file ‘bblayers.conf’ inside the ‘conf’
Create or modify the content of the file ‘bblayers.conf’ inside the ‘conf’ subdirectory of ‘ build_dunfell’
build_dunfell$ vim conf/bblayers.conf
Step 4. Check if the layers have been added correctly
After saving the bblayers.conf, check if the layers are compatible and they have been added correctly. If not, the following command will throw errors.
Step 5. Modify the content of the file conf/local.conf to specify the features of your Yocto build
This local.conf file is going to carry the information about the machine (hardware) for which you wish to build the Yocto Image. In the local.conf file you are going to specify which kind of image you intend to build. Similarly, here, in the local.conf you specify which are the packages you wish to add to the Yocto Operating System Image.
A ready to use example of local.conf
The local.conf file itself is a large file, I am going to include a ready to use example for you below.
build_dunfell$ vim conf/local.conf
Notes:
comments are preserved in the local.file to ease your understanding.
My example of local.conf supports the creation of Yocto Image that allows
execution of applications build with the Qt cross platform framework.
includes various goodies (cronie — Yocto’s flavour for Linux cron tool, lighttpd — Light web server, with php support, i2c tools , touchscreen support, etc)
The package added functionality is organized in “local.conf” styled variables (e.g. ${Qt_UTILS},${WEB_SERVER_UTILS}…) to make it easy to structure. I recommend this layout.
Yocto will look for these packages in the meta-layers you already specified in bblayers.conf and perform several tasks upon them, in the end, adding these as ready to use in the Yocto Image . The Yocto image is actually a custom made Linux Embedded Operating System.
You place Yocto on a micro SD card or whatever booting device, and you use Yocto to bring to life your embedded device. It is a Linux built by you, precisely for your embedded friend.
Step 6. Bitbake (Build) the Yocto Project Image taking into consideration the parameters you specified in the previous steps
I have additional details in my previous medium articles, in case you need a refreshment or you just landed here:
Don’t mind the Warnings: they refer to attention markers towards the packages supporting .gif files. They happen because I am not certain where to address its PACKAGECONFIG, but anyway, it finds its way in the end, and animated .gif-s can be rendered correctly.
If you do not want to see the orange color :), then comment/delete line 208 from the local.conf. Mind that you lose the support for animated .gif-s if you take it out of local.conf.
Step 7. Copy the Yocto .wic image file locally and deploy the image to the micro SD card
In my example, I am using Ubuntu 18.04 on a Virtual Machine running with Oracle VM VirtualBox
The micro SD Card /dev/sdb will contain the Operating System to power up your embedded device.
Test-run GStreamer with BeagleBone Black (ARM AM335x) and Yocto Project. Command line examples.
Verify that you have a working installation and inspect all the available plugins
Use gst-launch withtwo plug-ins that you really should have in all cases : fakesrc and fakesink
If the output looks similarly, then GStreamer is running correctly.
Display a test video
There are several possibilities to run the video: either on the framebuffer or via X11 Window System. It depends on your Yocto Image if it has these, or which can be used (e.g. core-image-minimal does not include an X11 window system, while core-image-sato includes X11)
If autovideosink doesn’t work, try an element that’s specific for your operating system and windowing system, such as ximagesink or glimagesink or (on windows) d3dvideosink.
glimagesink and ximagesink require an X instance, while fbdevsink uses a frame buffer directly.
Punctually, if your Yocto image is core-image-minimal (my example — or other) use the fbdevsink . If your Yocto image includes X11 (core-image-sato or other) then test ximagesink or glimagesink .
Note: In my scenario, BeagleBone Black did not cope well with rendering video when playing videos of Full HD or HD resolutions (1080p-720p-576p).
However, BeagleBone Black video rendering worked acceptably when playing videos at (SD) 480p and very well at 360p.
Nothing to say against it, BeagleBone Black stays to what it’s been defined, namely a decent low-cost community-supported development platform. It was not meant for HD video.
Samples from my display
(… sorry for the quality of the recordings…)
So, if you want HD or upward, you have to choose a more powerful platform.
Where to go next
Learn how to use the GStreamer API in your applications
I intend to provide an article about this later, meanwhile use the following documentation to learn more: