GstRtspServer.RTSPServer on Raspberry Pi [Python]

Vassiliev Valera.Vassiliev at gmail.com
Sun Mar 20 17:26:36 UTC 2016


Hello,

I want to stream video from my RPi's camera to my PC via Internet (Not local
network). I found that I can use RTSP server for that reason.
Firstly I tried to stream RPi cam's video on the localhost via TCP, than
server receives it and sharing (Or it just I thought that it will work like
this) combining founded info. But nothing happend and I decided to sort out
with server first.

The other problem is that my knowledge of C is pretty poor and I use Python,
while 9 of 10 examples are on C. So, here is the code that should stream
sample_video.mp4. Later I am going to change that line for rpicamsrc plugin.

#!/usr/bin/env python
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.13' #my RPi's local IP
        self.port = '8554'
        self.launch_description = '( playbin
uri=file:///home/pi/sample_video.mp4 )'
        
        self.server.set_address(self.address)
        self.server.set_service(self.port)  
        self.factory = GstRtspServer.RTSPMediaFactory()
        self.factory.set_launch(self.launch_description)
        self.factory.set_shared(True)
        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()
             
        
server = RTSP_Server()

Then on PC I launch this gst-launch-1.0 -v rtspsrc
location=rtsp://192.168.1.13:8554/video (Likely it is not full but I dont
know what to write else). And get this:

C:\gstreamer\1.0\x86_64\bin>gst-launch-1.0 -v rtspsrc
location=rtsp://192.168.1.
13:8554/video
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://192.168.1.13:8554/video
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not
get/se
t 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 ...


So, guys, what should I do?
Thnx in advance, 
Valeriy



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/GstRtspServer-RTSPServer-on-Raspberry-Pi-Python-tp4676461.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list