2016-03-22 5 views
0

ここでは、ちょうど今のmp4ファイルをストリーミングする必要があることGstRtspServerための私のコードです:の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 

そして、この受信:私は受け取りも

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> 

はPythonと最初FRAに 'クライアント接続します'私のビデオが開き、しばらくすると閉じます。

  • Gst.parse_launch( 'playbin URI =ファイル:/// E://...sample_video.mp4')OK動作します - (完全なアドレスで)
  • VLCはそれを開くことが不可能であることを述べていますRTSP://192.168.1.15:8554 /ビデオ
  • 私も
  • 127.0.0.1のローカルネットワーク
  • に別のコンピュータ上でそれを起動するとレイテンシ= 0のないストリームを受信しようとしました!デコードビン! autovideosink

問題:私はあなたの助けを楽しみにしています!お使いのサーバがリッスンしている

答えて

1

self.port = '554'

あなたはポート8554を再生しようとしている一方で:

VLCはそれが不可能であることを述べていますrtsp://192.168.1.15:8554/videoを開くには

+0

私は別のポールを試していましたts、それは誤った印刷です。別のフォーラムでは、私はplaybinがRTSPサーバーに合わないという回答を受け取りました。また、name = payXをパイプラインに含めるべきです。今私はそれがラズベリーパイで動作させるために遊んでいる.. – Vassiliev

関連する問題