Install GStreamer1.0 on ubuntu

1. Preparation

Gstreamer is a cross-platform multimedia framework that supports Windows, Linux, Android, and iOS. The application can connect the various steps of multimedia processing in series through the pipeline (Pipeline) to achieve the desired effect. Each step is implemented by means of plugins based on the GObject object system based on the Element (Element), which facilitates the expansion of various functions.

GStreamer is included in Linux distributions that are officially recommended to use the latest version of the system, such as Fedora, Ubuntu, Debain or OpenSuse.

2. Install the required dependencies and GStreamer

A total of 15 dependencies (including GStreamer), those that have been installed in the system will not be installed repeatedly, and those that have not been installed will be installed.

sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

3. Use GStreamer to build applications

The only other "development environment" needed is a gcc compiler and a text editor. Code compilation (compile) requires GStreamer and uses the code of the GStreamer core library, so the location of the gstreamer-1.0 header file and library file must be specified to the gcc compiler through the following code.

pkg-config --cflags --libs gstreamer-1.0

The execution results are as follows:

-pthread -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0

4. Verify that the installation is successful

gst-inspect-1.0 --version

You can see the output version information of gst-inspect-1.0 and GStreamer.

(base) dzh:~$ gst-inspect-1.0 --version
gst-inspect-1.0 version 1.14.0
GStreamer 1.14.0
Unknown package origin

5. Eliminate the influence of Anaconda

Because the base environment of Anaconda3 will also install gstreamer, 错误: 无法创建管道: 无组件“rtspsrc”the problem is caused.

1. Enter the command to view the installed gstreamer version:

apt list --installed | grep gstreamer*

You can see that the gst tools installed locally are all 1.14.5, but why are the versions output above all 1.14.0?
insert image description here

2. According to the previous environment variable experience, enter the command whereis gst-launch-1.0to check its binary file location, as expected, there is also a gst-launch-1.0 under anaconda3, and then the system first finds anaconda3 in the environment variable.

(base) dzh:~$ whereis gst-launch-1.0
gst-launch-1: /usr/bin/gst-launch-1.0 /home/dzh/anaconda3/bin/gst-launch-1.0

3. Next, activate the base environment, check the conda list to see which ones are related to gstreamer, and then remove these packages.

conda activate base
conda list
conda remove gstreamer
conda remove gst-plugins-base

4. Verify the default version of gst-launch-1.0 again:

(base) dzh:~$ gst-launch-1.0 --version
gst-launch-1.0 version 1.14.5
GStreamer 1.14.5
https://launchpad.net/distros/ubuntu/+source/gstreamer1.0

Give up meaningless social interactions, stay away from people who consume you, and learn to say no.

Guess you like

Origin blog.csdn.net/qq_42257666/article/details/130539023