需要帮助使用 rtps 协议通过以太网流式传输 isp 摄像机。我有下面列出的代码。 问题:我无法使用 vlc 应用程序观看来自客户端的流
source = Gst.ElementFactory.make("qtiqmmfsrc", "qmmf-source")
framefilter = Gst.ElementFactory.make("capsfilter", "frame-filter")
decoder = Gst.ElementFactory.make("nvv4l2decoder", "nvv4l2-decoder")
converter = Gst.ElementFactory.make("nvvidconv", "video-converter")
encoder = Gst.ElementFactory.make("nvv4l2h264enc", "h264-encoder")
muxer = Gst.ElementFactory.make("mpegtsmux", "mpegts-muxer")
parse = Gst.ElementFactory.make("h264parse", "h264-parse")
queue = Gst.ElementFactory.make("queue", "queue")
sink = Gst.ElementFactory.make("udpsink", "udp-sink")
# set properties to the elements
source.set_property("camera", camera_id)
if camera_id == 0:
framefilter.set_property("caps", Gst.Caps.from_string(
"video/x-h264,format=NV12 framerate=30/1,width=1920, height=1080"))
else:
framefilter.set_property("caps", Gst.Caps.from_string(
"video/x-h264, framerate=30/1,width=1280, height=720"))
sink.set_property("host", sys.argv[2])
sink.set_property("port", port)
rtppay = Gst.ElementFactory.make("rtph264pay", "rtppay")
# Build the pipeline
pipeline.add(source)
pipeline.add(parse)
pipeline.add(framefilter)
pipeline.add(muxer)
pipeline.add(queue)
pipeline.add(sink)
if not Gst.Element.link(source, parse):
print("ERROR: Could not link source to h264parser")
sys.exit(1)
if not Gst.Element.link(parse, framefilter):
print("ERROR: Could not link h264parser to decoder")
sys.exit(1)
if not Gst.Element.link(framefilter, muxer):
print("ERROR: Could not link capsfilter to converter")
sys.exit(1)
if not Gst.Element.link(muxer, queue):
print("ERROR: Could not link muxer to queue")
sys.exit(1)
if not Gst.Element.link(queue, sink):
print("ERROR: Could not link queue to sink")
sys.exit(1)
try:
print("Streaming started...")
pipeline.set_state(Gst.State.PLAYING)
print("vlc at ip:%s:%d" % (sys.argv[2], port))
print('Press Ctrl+C to stop')
loop.run()
except KeyboardInterrupt:
print("Streaming stopped due to keyboard Interrupt")
pipeline.set_state(Gst.State.NULL)
sys.exit(0)
如果我的设置管道正确,需要帮助! 我的目标是通过以太网实现低延迟的摄像头流
这是 MPEG TS 流管道,而不是 RTSP 管道。如果您确实需要 RTSP,则需要使用 GStreamer 的 RTSP 服务器。以下是一些示例:
https://github.com/GStreamer/gstreamer/tree/main/subprojects/gst-rtsp-server/examples