0
這裏是我的GstRtspServer代碼應該只是流MP4文件現在:的Gstreamer RTSP服務器不工作(SDP不包含流)
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstRtspServer', '1.0')
from gi.repository import Gst, GObject, GstRtspServer
GObject.threads_init()
Gst.init(None)
class RTSP_Server:
def __init__(self):
self.server = GstRtspServer.RTSPServer.new()
self.address = '192.168.1.15'
self.port = '8554'
self.launch_description = '(playbin uri=file:///E://...sample_video.mp4)'
self.server.set_address(self.address)
self.server.set_service(self.port)
self.server.connect("client-connected",self.client_connected)
self.factory = GstRtspServer.RTSPMediaFactory.new()
self.factory.set_launch(self.launch_description)
self.factory.set_shared(True)
self.factory.set_transport_mode(GstRtspServer.RTSPTransportMode.PLAY)
self.mount_points = self.server.get_mount_points()
self.mount_points.add_factory('/video', self.factory)
self.server.attach(None)
print('Stream ready')
GObject.MainLoop().run()
def client_connected(self, arg1, arg2):
print('Client connected')
server = RTSP_Server()
我運行它,讓「流準備好」,然後鍵入命令行:
C:\gstreamer\1.0\x86_64\bin>gst-launch-1.0 rtspsrc location=rtsp://192.168.1.15:8554/video latency=0 ! decodebin ! autovideosink
和接收這樣的:在Python和第一FRA
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://192.168.1.15:8554/video
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not get/set settings from/on resource.
Additional debug info:
gstrtspsrc.c(6845): gst_rtspsrc_setup_streams(): /GstPipeline:pipeline0/GstRTSP
Src:rtspsrc0:
SDP contains no streams
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
C:\gstreamer\1.0\x86_64\bin>
我也收到 '客戶端連接'視頻的我打開,然後關閉一會兒。
- Gst.parse_launch( 'playbin URI =文件:/// E://...sample_video.mp4')的工作原理確定 - (全文地址)
- VLC說,這是不可能打開RTSP://192.168.1.15:8554 /視頻
- 我試着啓動另一臺計算機上的本地網絡
- 隨着127.0.0.1以及
- 和接收無延遲= 0流!解碼器! autovideosink
什麼問題?我期待着您的幫助!
我在嘗試不同的por因爲這是一個誤印。在另一個論壇上,我收到了一個答案,即playbin不適合RTSP服務器,並且我還應該在管道中包含name = payX。現在我正在玩,以使它在Raspberry Pi上運行。 – Vassiliev