想用python实现一个推流服务,下面记录一下配置过程。
系统是ubuntu18.04,python3.6和3.8中都试过。
1、安装gstreamer
sudo apt-get install 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
2、安装gst-rtsp-server
sudo apt-get install libgstrtspserver-1.0-dev gstreamer1.0-rtsp
3、安装python3-gi
sudo apt-get install python3-gi
4、再安装一堆东西
sudo apt-get install pkg-config libcairo2-dev gcc python3-dev libgirepository1.0-dev
5、安装python库gobject和PyGObject
pip install gobject PyGObject
?6、最后测试一下
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstRtspServer', '1.0')
from gi.repository import Gst, GstRtspServer, GObject, GLib
把上面这段代码复制到一个.py文件里运行一下,如果上面代码没有任何输出和报错,那就是配置成功了。
|