GStreamer 源码 Meson 编译 1.20¶
版本与环境介绍
GStreamer version : 1.20
Ubuntu : 18.04
1. 下载 GStreamer 源码¶
git clone -b 1.20 https://gitlab.freedesktop.org/gstreamer/gstreamer.git
这里下载1.20版本

2. 配置¶
不指定option的情况下,执行meson,会按默认的规则编译,是不带libav,x264的。
meson configure | grep 264可以查看是否编译进去;
pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer$ meson configure | grep 264
libopenh264 auto [enabled, disabled, auto] libopenh264
libx264 auto [enabled, disabled, auto] libx264
openh264 auto [enabled, disabled, auto] H.264 video codec plugin
uvch264 auto [enabled, disabled, auto] UVC compliant H.264 camera source plugin
x264 auto [enabled, disabled, auto] H.264 video encoder plugin based on libx264 (GPL - only built if
x264_libraries Colon separated list of additional x264 library paths, e.g. for
Subproject openh264:

指定reconfigure
指定安装目录
3. 编译¶
4. 安装¶
安装
5. 虚拟环境测试¶
pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer$ cd build/
pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer/build$ ls
build.ninja compile_commands.json GstDocumentedSubprojects GstPluginsPath.json meson-info meson-logs meson-private meson-uninstalled subprojects tests
pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer/build$ ninja devenv
[0/1] Running external command devenv (wrapped by meson to set env)
[gst-1.20] pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer/build$
![pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer$ cd build/ pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer/bui1d$ Is build . ninja compile _ commands . j son GS tDocumentedSubproj ects Gstpluginspath . json pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer/build$ ninja devenv [0/1] Running external command devenv (wrapped by meson to set env) [gst-1.20] pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer/build$ [gst-1.20] pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer/build$ gst- meson-info meson -](image/clip_image003.png)
![[gst-l .20] pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer/build$ [gst-1.2a] gst-inspect-l.e I grep 264 libav: avdec h264. libav H. 264 / AVC / MPEG-4 AVC / MPEG-4 part 10 decoder libav: avmux_ipod: libav ipod H. 264 MP4 (MPEG-4 Part 14) muxer rtp: rtph264depay: RTP H264 depayloader rtp: rtph264pay: RTP H264 payloader typefindfunctions: video/x-h264• h264, x264, 264 videoparsersbad: h264parse: H. 264 parser](image/clip_image004-17225851402312.png)
6. 遇到问题¶
6.1 Python 版本切换¶
# 查看有哪些版本
ls /usr/bin/python*
# 设定:
alias python=/usr/bin/python3.8
alias python3=/usr/bin/python3.8

再更新为3.7

6.2 Meson 版本¶
版本需要0.60以上,发现版本不对
pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer$ meson --version
0.45.1
pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer$ pip3 install --user meson
Collecting meson
Downloading https://files.pythonhosted.org/packages/95/0a/c961c525cd1b2914fa9cc85692f25a44012759ca1f25a96bda3fec74aa09/meson-0.61.4-py3-none-any.whl (863kB)
100% |████████████████████████████████| 870kB 1.7MB/s
Installing collected packages: meson
Successfully installed meson-0.61.4
pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer$ meson --version
0.45.1
发现版本还是不对;
[原因: 继续搜索发现pip3会将软件安装到/home/user/.local/bin 而系统默认是使用/usr/bin/meson]
设置环境变量
pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer$ export PATH=~/.local/bin:$PATH
pub@ubuntu64:/mnt/work/zheng/gstreamer/gstreamer$ meson --version
0.61.4
正常
部分需要修改root 用户相关的版本
$ git clone -b 1.20 https://github.com/GStreamer/gst-rtsp-server.git
meson --reconfigure build --prefix=/home/mhpub/gstreamer/gst-rtsp-server/build/out
网络相关问题,代理
git config --global user.name "hywelstar"
git config --global user.email "hywelstar@126.com"
git config --list
export http_proxy=http://192.168.5.104:10809
export https_proxy=https://192.168.5.104:10809
git config --global http.proxy http://192.168.5.104:10809
git config --global https.proxy https://192.168.5.104:10809
############取消代理############
git config --global --unset http.proxy
git config --global --unset https.proxy
unset http_proxy
unset https_proxy