0

我需要将 4 个 RTSP 流录制到 Kinesis Video Streams 的单个流中。流必须像这样放置在视频中:

 ---------- ---------- 
|          |          |
| STREAM 1 | STREAM 2 |
|          |          |
|----------|----------|
|          |          |
| STREAM 3 | STREAM 4 |
|          |          |
 ---------- ----------

使用以下命令,我能够插入单个流并使其完美运行:

gst-launch-1.0 rtspsrc user-id="admin" user-pw="password" location="rtsp://admin:password@192.168.0.1:554/cam/realmonitor?channel=1&subtype=0" short-header=TRUE ! rtph265depay ! h265parse ! video/x-h265, alignment=au ! kvssink stream-name="test-stream" storage-size=512 access-key="access-key" secret-key="secret-key" aws-region="us-east-1" 

但是,我的目标是将一组流插入到 Kinesis Video Streams 中的同一流中。为此,我找到了以下示例videomixer

gst-launch-1.0 -e rtspsrc location=rtsp_url1 ! rtph264depay ! h264parse ! decodebin ! videoconvert! m.sink_0 \
                rtspsrc location=rtsp_url2 ! rtph264depay ! h264parse ! decodebin ! videoconvert! m.sink_1 \
                rtspsrc location=rtsp_url3 ! rtph264depay ! h264parse ! decodebin ! videoconvert! m.sink_2 \
                rtspsrc location=rtsp_url4 ! rtph264depay ! h264parse ! decodebin ! videoconvert! m.sink_3 \
                videomixer name=m sink_1::xpos=1280 sink_2::ypos=720 sink_3::xpos=1280 sink_3::ypos=720 ! x264enc ! mp4mux ! filesink location=./out.mp4 sync=true

我将示例调整为仅两个流,并使用如下命令使其在容器内工作:

gst-launch-1.0 -e rtspsrc user-id="admin" user-pw="password" location="rtsp://password@192.168.0.1:554/cam/realmonitor?channel=1&subtype=0" short-header=TRUE ! rtph265depay ! h265parse ! video/x-h265, alignment=au ! libde265dec ! videoconvert ! m.sink_0 \
        rtspsrc user-id="admin" user-pw="password" location="rtsp://password@192.168.0.2:554/cam/realmonitor?channel=1&subtype=0" short-header=TRUE ! rtph265depay ! h265parse ! video/x-h265, alignment=au ! libde265dec ! videoconvert ! m.sink_1 \
        videomixer name=m sink_0::xpos=1080 sink_1::ypos=1080 ! x265enc ! h265parse ! video/x-h265, alignment=au ! kvssink stream-name="test-stream" storage-size=512 access-key="access-key" secret-key="secret-key" aws-region="us-east-1" 

以另一种方式:

gst-launch-1.0 -e videomixer name=mix sink_0::xpos=0 sink_0::ypos=0 sink_0::alpha=0 sink_1::xpos=0 sink_1::ypos=0 \
    rtspsrc user-id="admin" user-pw="password" location="rtsp://password@192.168.0.1:554/cam/realmonitor?channel=1&subtype=0" short-header=TRUE ! rtph265depay ! h265parse ! video/x-h265, alignment=au ! libde265dec ! videoconvert ! videoscale ! video/x-raw,width=1920,height=1080 ! mix.sink_0 \
    rtspsrc user-id="admin" user-pw="password" location="rtsp://password@192.168.0.2:554/cam/realmonitor?channel=1&subtype=0" short-header=TRUE ! rtph265depay ! h265parse ! video/x-h265, alignment=au ! libde265dec ! videoconvert ! videoscale ! video/x-raw,width=1920,height=1080 ! mix.sink_1 \
    mix. ! queue ! videoconvert ! x265enc ! queue ! kvssink stream-name="test-stream" storage-size=512 access-key="access-key" secret-key="secret-key" aws-region="us-east-1" 

有问题的容器来自:https ://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp

但是,当我登录 Kinesis Video Streams 并尝试下载 getClip 时,在这两种情况下我都会收到以下错误:

MissingCodecPrivateDataException
曲目 1 的片段中缺少编解码器私有数据。
状态代码:400

GST_DEBUG=1 的日志可以在 https://gist.github.com/vbbandeira/b15ec8af6986237a4cd7e382e4ede261找到

GST_DEBUG=4 的日志可以在 https://gist.github.com/vbbandeira/6bd4b7a014a69da5f46cd036eaf32aec找到

你们能告诉我那里发生了什么吗?

或者如果可能,请帮助我找到解决此错误的方法。

谢谢!

4

1 回答 1

0

对于那些寻找相同解决方案的人,我设法通过替换videomixer已弃用的来使其工作composer,下面是我使用的命令的示例并且它有效:

gst-launch-1.0 rtspsrc location="rtsp://password@192.168.0.1:554/cam/realmonitor?channel=1&subtype=0" short-header=TRUE ! decodebin ! videoconvert ! comp.sink_0 \
rtspsrc location="rtsp://password@192.168.0.2:554/cam/realmonitor?channel=1&subtype=0" short-header=TRUE ! decodebin ! videoconvert ! comp.sink_1 \
compositor name=comp sink_0::xpos=0 sink_1::xpos=1280 ! x264enc ! kvssink stream-name="test-stream" storage-size=512 access-key="access-key" secret-key="secret-key" aws-region="us-east-1" 

但是,我只能使用 h264 来做到这一点。

于 2021-10-05T20:00:03.643 回答