RTSP 流相关工具介绍

RTSP (Real Time Streaming Protocol),实时流协议,是一种应用层协议,专为流媒体使用。本文将介绍 GStreamer, VLC, FFmpeg 这几个工具,如何发送、接收 RTSP 流。

前提

GStreamer

安装:

sudo apt 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

查看所有插件:

# conda deactivate
gst-inspect-1.0 -a

播放 ~/Videos/test.mp4 文件:

gst-launch-1.0 filesrc location=~/Videos/test.mp4 ! decodebin ! autovideosink

播放 /dev/video0 webcam:

gst-launch-1.0 v4l2src device=/dev/video0 \
! video/x-raw, format=YUY2, width=640, height=480, framerate=30/1 \
! autovideosink

/dev/video0 相关信息,可见后文“关于 Webcam”。

GStreamer RTSP Server

编译 test-launch 例子:

sudo apt install libgstreamer1.0-dev libgstrtspserver-1.0

git clone https://github.com/GStreamer/gst-rtsp-server.git

cd gst-rtsp-server/
git checkout 1.18

cd examples/
gcc test-launch.c -o test-launch $(pkg-config --cflags --libs gstreamer-rtsp-server-1.0)

test-launch 发送 RTSP 测试流:

$ ./test-launch "videotestsrc ! x264enc ! rtph264pay name=pay0 pt=96"
stream ready at rtsp://127.0.0.1:8554/test

gst-launch 接收 RTSP 测试流:

gst-launch-1.0 playbin uri=rtsp://127.0.0.1:8554/test

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值