使用gstreamer中自带的rtsp服务器,就能快速的以管道的形式搭建rtsp服务器推流
下载gst-rtsp-server
查看自己系统gstreamer的版本,在gstreamer官网下载相关版本.tar.xz源码包。解压后进入目录。./configurer 然后make编译。进入examples目录就能看到已经编译好的各种示例程序以及源码
gst-inspect-1.0 --version
推流usb摄像头JPEG格式视频同时显示
./test-launch “( v4l2src device=/dev/video0 ! image/jpeg,width=1280,height=720,framerate=30/1 ! jpegdec ! timeoverlay ! tee name=vsrc vsrc. ! queue ! videoconvert ! ximagesink vsrc. ! queue ! x264enc tune=zerolatency ! rtph264pay name=pay0 pt=96 )”
推流videotestsrc
./test-launch “( videotestsrc ! video/x-raw,width=640,height=480,framerate=30/1 ! timeoverlay ! tee name=vsrc vsrc. ! queue ! videoconvert ! ximagesink vsrc. ! queue ! x264enc tune=zerolatency ! rtph264pay name=pay0 pt=96 )”
转发H265
./test-launch "( rtspsrc latency=10 location=rtsp://192.168.20.51:8554/123 ! queue ! rtph265depay ! queue ! rtph265pay name=pay0 pt=98 )"
转发H264
./test-launch "( rtspsrc latency=20 location=rtsp://192.168.20.51:8554/123 ! queue ! rtph264depay ! queue ! rtph264pay name=pay0 pt=96 )"
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
sudo apt install mpv
sudo apt install libmpv-dev
mpv rtsp://192.168.144.25:8554/main.264
安装gstreamer基础库
sudo apt-get install libgl1-mesa-dev
sudo apt-get install gstreamer1.0-libav
sudo apt-get install gstreamer1.0-plugins-bad
sudo apt-get install gstreamer1.0-plugins-base
sudo apt-get install gstreamer1.0-plugins-ugly
sudo apt-get install gstreamer1.0-plugins-good
安装gst-rtsp功能包
sudo apt-get install gtk-doc-tools
git clone -b 1.8 https://github.com/GStreamer/gst-rtsp-server.git
cd gst-rtsp-server
./autogen.sh
sudo make
cd example/
./test-launch "( rtspsrc latency=20 location=rtsp://192.168.1.64 ! queue ! rtph264depay ! queue ! rtph264pay name=pay0 pt=96 )"
configure: error: Package requirements (glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0) were not met:
No package ‘glib-2.0’ found
No package ‘gobject-2.0’ found
sudo apt install -y libglib2.0-dev