Reputation: 47
Here is my code for GstRtspServer that should just stream mp4 file for now:
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()
I run it, get 'Stream ready' and then type in command line:
C:\gstreamer\1.0\x86_64\bin>gst-launch-1.0 rtspsrc location=rtsp://192.168.1.15:8554/video latency=0 ! decodebin ! autovideosink
And receive this:
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>
Also I receive 'Client connected' in Python and first frame of the video opens and then closes after a moment.
What's the problem? I am looking forward to your help!
Upvotes: 0
Views: 5033
Reputation: 34
Your server is listening on:
self.port = '554'
while You are trying to play port 8554:
VLC says that it is impossible to open rtsp://192.168.1.15:8554/video
Upvotes: 1