You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用gst-launch-1.0选择Parrot无人机RTSP特定摄像头流

如何用gst-launch-1.0指定播放Parrot无人机RTSP推流中的特定摄像头流

我有一架Parrot无人机,它的4个摄像头通过RTSP协议推流,所有流的地址均为rtsp://192.168.53.1:554/live。我希望用gst-launch-1.0指定显示某个摄像头的流,当前运行以下命令:

gst-launch-1.0 rtspsrc location=rtsp://192.168.53.1:554/live latency=0 ! queue ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw,width=1920,height=1080 ! autovideosink

能看到其中一个流,但显示的是4个流中的随机一个。命令运行输出如下:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://192.168.53.1:554/live
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (request) SETUP stream 2
Progress: (request) SETUP stream 3
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request

流帧截图说明:

  • 主摄像头流:画面为无人机前方常规视角,清晰无畸变
  • 立体摄像头流:画面带有明显鱼眼畸变,为双目立体视觉视角

请问如何指定显示特定的摄像头流?


解决方案

要指定播放RTSP流中的特定摄像头,核心是利用GStreamer的rtspsrc元素提供的stream-index参数,该参数可明确指定要拉取的RTSP流索引。

1. 修改命令添加stream-index参数

在rtspsrc后追加stream-index=N(N为流索引,对应输出里的stream 0到stream 3),示例命令如下:

指定播放stream 0:

gst-launch-1.0 rtspsrc location=rtsp://192.168.53.1:554/live latency=0 stream-index=0 ! queue ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw,width=1920,height=1080 ! autovideosink

指定播放stream 1:

gst-launch-1.0 rtspsrc location=rtsp://192.168.53.1:554/live latency=0 stream-index=1 ! queue ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw,width=1920,height=1080 ! autovideosink

2. 匹配索引与摄像头

无人机流索引和摄像头的对应关系无固定公开映射,你可以逐个测试stream-index=0到3的命令,通过画面特征(比如主摄像头的常规视角、立体摄像头的鱼眼畸变)确定目标摄像头对应的索引。

补充:查看RTSP流SDP信息(可选)

若需精准确认每个流的属性,可先打印SDP信息辅助判断:

gst-launch-1.0 rtspsrc location=rtsp://192.168.53.1:554/live debug=1

输出会包含每个stream的详细参数,可能标注摄像头类型或分辨率,帮助快速匹配索引与摄像头。

内容的提问来源于stack exchange,提问作者madswamp

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 15:20:21