Select the version of your OS from the tabs below. If you don't know the version you are using, run the command cat /etc/os-release
or cat /etc/issue
on the board.
TorizonCore platform features Docker runtime. Toradex provides Debian Docker images and deb packages that greatly eases the development process for embedded applications. In this article, we will show how you can run GStreamer in a container with TorizonCore.
The article Video Encoding and Playback (Linux) is not specific for Torizon, but some instructions may be applicable. For example, generic information about Wayland/Weston is provided.
NXP provides GStreamer plugins to access the multimedia libraries using the i.MX SoC's hardware acceleration units. TorizonCore helps to reduce the complexity of the setup with Debian packages providing these HW optimized GStreamer plugins.
A Toradex's SoM with TorizonCore installed (To get instructions about how to install TorizonCore, see Quickstart Guide)
Basic knowledge of Docker containers. To learn more about Docker, visit the developer's website. To learn the first steps with Docker usage and TorizonCore, check the Quickstart Guide.
To take the best from this article and test things in practice, we recommend that you clone the torizon-samples repository to your computer:
$ cd ~
$ git clone --branch bullseye https://github.com/toradex/torizon-samples.git
This example will run a pipeline that uses waylandsink GStreamer's plugin. This plugin runs on top of Wayland and Weston. It will be necessary to start 2 containers: One with the Weston image, and one with the application image, with Wayland support. Both will communicate through shared folders by bind mounting.
The implementation details will be explained in this session. See the Quickstart Guide with the instructions about how to compile the image on a host pc and pull the image in the board. You can also scp
this file to the board and build it locally.
Select your architecture from the boxes below:
Now it's a good time to use torizon-samples repository:
$ cd torizon-samples/gstreamer/bash/simple-pipeline
$ docker build -f Dockerfile.arm64 -t <your-dockerhub-username>/gst_example .
After the build, push the image to your Dockerhub account:
$ docker push <your-dockerhub-username>/gst_example
Now it's a good time to use torizon-samples repository:
$ cd ~/torizon-samples/gstreamer/bash/simple-pipeline
$ docker build -f Dockerfile.armhf -t <your-dockerhub-username>/gst_example .
After the build, push the image to your Dockerhub account:
$ docker push <your-dockerhub-username>/gst_example
In this section, you will go through some important snippets containing information about the Dockerfile.
Toradex provides a basic Wayland image in its Dockerhub page. If you are using an iMX8 (arm64v8 CPU) computer-on-module (COM) add torizon/wayland-base-vivante
to your image. Otherwise, add --platform=linux/arm torizon/wayland-base
. It contains the repository package. Remember to use a version of the container that is compatible with the version of TorizonCore you are using, from the container tag.
Choose from the tabs:
FROM torizon/wayland-base-vivante:2
FROM --platform=linux/arm torizon/wayland-base:2
Install the required packages on the image with the following commands:
RUN apt update
RUN apt install -y libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
RUN apt update
RUN apt install -y libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-pulseaudio
We will test GStreamer as entrypoint for our Dockerfile. A test source pattern will be output to a Wayland window. You can modify the pipeline for your needs
ENTRYPOINT gst-launch-1.0 videotestsrc ! videoconvert ! videoscale ! waylandsink sync=false
After building the Dockerfile image above and pushing it to your Dockerhub, you can launch Weston and Wayland with docker-compose.
Select your architecture from the tabs:
Still on the torizon-samples/gstreamer/bash/simple-pipeline
directory, edit the docker-compose.arm64.yaml
file by filling the Weston image field with your image repository:
depends_on: - weston image: <your-username>/<your-image> volumes:
After filling it, send it to your module using scp
:
$ scp docker-compose.arm64.yaml torizon@<your-ip>:/home/torizon
Now enter your module using SSH:
$ ssh torizon@<your-ip>
Note: For more information about SSH, please refer to SSH on Linux.
Now you can launch by using the command:
# docker-compose -f docker-compose.arm64.yaml up
Still on the torizon-samples/gstreamer/bash/simple-pipeline
directory, edit the docker-compose.armhf.yaml
file by filling the Weston image field with your image repository:
depends_on: - weston image: <your-username>/<your-image> volumes:
After filling it, send it to your module using scp
:
$ scp docker-compose.armhf.yaml torizon@<your-ip>:/home/torizon
Now enter your module using SSH:
$ ssh torizon@<your-ip>
Note: For more information about SSH, please refer to SSH on Linux.
Now you can launch by using the command:
# docker-compose -f docker-compose.armhf.yaml up
Still on the torizon-samples/gstreamer/bash/simple-pipeline
directory, edit the docker-compose.colibri-imx7.yaml
file by filling the Weston image field with your image repository:
depends_on: - weston image: <your-username>/<your-image> volumes:
After filling it, send it to your module using scp
:
$ scp docker-compose.colibri-imx7.yaml torizon@<your-ip>:/home/torizon
Now enter your module using SSH:
$ ssh torizon@<your-ip>
Note: For more information about SSH, please refer to SSH on Linux.
Now you can launch by using the command:
# docker-compose -f docker-compose.colibri-imx7.yaml up
TorizonCore platform features Docker runtime. Toradex provides Debian Docker images and deb packages that greatly eases the development process for embedded applications. In this article, we will show how you can run Gstreamer in a container with TorizonCore.
Warning: Currently only plugins from the Gstreamer project repository are available. A Debian package with VPU accelerated Gstreamer plugins for i.MX will be available soon. Please contact your Toradex representative if you need more information about this plugin.
A Toradex's SoM with TorizonCore installed (To get instructions about how to install TorizonCore, see Quickstart Guide)
Basic knowledge of Docker containers. To learn more about Docker, visit the developer's website. To learn the first steps with Docker usage and TorizonCore, check the Quickstart Guide.
To take the best from this article and test things in practice, we recommend that you clone the torizon-samples repository to your computer:
$ cd ~
$ git clone https://github.com/toradex/torizon-samples.git
$ cd torizon-samples/gstreamer
This example will run a pipeline that uses waylandsink Gstreamer's plugin. This plugin runs on top of Wayland and Weston. It will be necessary to start 2 containers: One with the Weston image, and one with the application image, with Wayland support. Both will communicate through shared folders by bind mounting.
The implementation details will be explained in this session. See the Quickstart Guide with the instructions about how to compile the image on a host pc and pull the image in the board. You can also scp
this file to the board and build it locally.
Select your architecture from the boxes below:
Now it's a good time to use torizon-samples repository:
$ cd ~/torizon-samples/gstreamer/bash/simple-pipeline
$ docker build -f Dockerfile.arm64 -t <your-dockerhub-username>/gst_example .
After the build, push the image to your Dockerhub account:
$ docker push <your-dockerhub-username>/gst_example
Now it's a good time to use torizon-samples repository:
$ cd ~/torizon-samples/gstreamer/bash/simple-pipeline
$ docker build -f Dockerfile.armhf -t <your-dockerhub-username>/gst_example .
After the build, push the image to your Dockerhub account:
$ docker push <your-dockerhub-username>/gst_example
In this section, you will go through some important snippets containing information about the Dockerfile.
Toradex provides a basic Wayland image in its Dockerhub page. If you are using an iMX8 (arm64v8 CPU) computer-on-module (COM) add torizon/arm64v8-debian-wayland-base-vivante
to your image. Otherwise, add torizon/arm32v7-debian-wayland-base
. It contains the repository package.
Choose from the tabs:
FROM torizon/arm64v8-debian-wayland-base-vivante
FROM torizon/arm32v7-debian-wayland-base
Install the required packages on the image with the following commands:
RUN apt update
RUN apt install -y libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
We will test Gstreamer as entrypoint for our Dockerfile. A test source pattern will be output to a Wayland window. You can modify the pipeline for your needs
ENTRYPOINT gst-launch-1.0 videotestsrc ! videoconvert ! videoscale ! waylandsink sync=false
After building the Dockerfile image above and pushing it to your Dockerhub, you can launch Weston and Wayland with docker-compose.
Select your architecture from the tabs:
Now it's a good time to use torizon-samples repository:
$ cd ~/torizon-samples/gstreamer/bash/simple-pipeline
Then fill the Weston image field with your image repository:
docker-composedepends_on: - weston image: <your-username>/<your-image> volumes:
After filling it, send it to your module using scp
:
$ scp docker-compose.armhf torizon@<your-ip>:/home/torizon
Now enter your module using SSH:
$ ssh torizon@<your-ip>
Note: For more information about SSH, please refer to SSH on Linux.
Now you can launch by using the command:
# docker-compose -f docker-compose.arm64.yaml up
Now it's a good time to use torizon-samples repository:
$ cd ~/torizon-samples/gstreamer/bash/simple-pipeline
Then fill the Weston image field with your image repository:
docker-composedepends_on: - weston image: <your-username>/<your-image> volumes:
After filling it, send it to your module using scp
:
$ scp docker-compose.armhf torizon@<your-ip>:/home/torizon
Now enter your module using SSH:
$ ssh torizon@<your-ip>
Note: For more information about SSH, please refer to SSH on Linux.
Now you can launch by using the command:
# docker-compose -f docker-compose.armhf.yaml up