Search by Tags

How to use Gstreamer on TorizonCore

 
Applicable for

Article updated at 25 Sep 2020
Compare with Revision




Subscribe for this article updates

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.

Torizon 5.0.0

Introduction

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.

Typographic Conventions

Prerequisites

  • 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

Wayland + Weston

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.

Dockerfile instructions

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.

To build

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

Details about the Dockerfile

In this section, you will go through some important snippets containing information about the Dockerfile.

Toradex Debian image - Wayland

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.

Choose from the tabs:

FROM torizon/wayland-base-vivante:1
FROM --platform=linux/arm torizon/wayland-base:1

Install Gstreamer application and plugins

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

Test gstreamer

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

Docker-compose

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:


depends_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:


depends_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

Torizon 4.0.0

Introduction

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.

Typographic Conventions

Prerequisites

  • 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

Wayland + Weston

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.

Dockerfile instructions

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.

To build

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

Details about the Dockerfile

In this section, you will go through some important snippets containing information about the Dockerfile.

Toradex Debian image - Wayland

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 Gstreamer application and plugins

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

Test gstreamer

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

Docker-compose

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-compose
depends_on: - weston 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-compose
depends_on: - weston 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