semofa
Posts: 21
Joined: Mon Jun 01, 2015 8:18 pm

problem with play streamed video on raspberry pi

Sun Jul 12, 2015 1:41 pm

I have two Raspberry Pi. I run gstreamer in one of them to stream video, and run a python program that wrote myself on the other to recieve video.

here is the gstreamer command on the first Raspberry pi:

Code: Select all

raspivid -t 999999 -w 1080 -h 720 -fps 25 -hf -b 2000000 -o - | \gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 \! gdppay ! tcpserversink host=serverIp port=5000
and here is my python program:

Code: Select all

#!/usr/bin/python3

from os import path

import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst, Gtk

# Needed for window.get_xid(), xvimagesink.set_window_handle(), respectively:
from gi.repository import GdkX11, GstVideo


GObject.threads_init()
Gst.init(None)


class Player(object):
    def __init__(self):
        
        # Create GStreamer pipeline
        self.pipeline = Gst.Pipeline()
        self.pipeline_A = Gst.Pipeline()

      
        self.Video_Pipeline()
        self.Audio_Pipeline()
##############################################################################
#VIDEO Pipeline
#|
#|
#V
##############################################################################

    def Video_Pipeline(self):

        self.tcpsrc = Gst.ElementFactory.make('tcpclientsrc','tcpsrc')
        self.tcpsrc.set_property("host", '192.168.1.4')
        self.tcpsrc.set_property("port", 5000)

        self.gdepay = Gst.ElementFactory.make('gdpdepay', 'gdepay')
        

        self.rdepay = Gst.ElementFactory.make('rtph264depay', 'rdepay')

        self.avdec = Gst.ElementFactory.make('avdec_h264', 'avdec')

        self.vidconvert = Gst.ElementFactory.make('videoconvert', 'vidconvert')
        
        self.asink = Gst.ElementFactory.make('autovideosink', 'asink')
        self.asink.set_property('sync', False)
        #self.asink.set_property('emit-signals', True)
        #self.set_property('drop', True)

        self.pipeline.add(self.tcpsrc)
        self.pipeline.add(self.gdepay)
        self.pipeline.add(self.rdepay)
        self.pipeline.add(self.avdec)
        self.pipeline.add(self.vidconvert)
        self.pipeline.add(self.asink)

        self.tcpsrc.link(self.gdepay)
        self.gdepay.link(self.rdepay)
        self.rdepay.link(self.avdec)
        self.avdec.link(self.vidconvert)
        self.vidconvert.link(self.asink)
##############################################################################
#^
#|
#|
#VIDEO Pipeline
##############################################################################


##############################################################################
#AUDIO Pipeline
#|
#|
#V
##############################################################################
    def Audio_Pipeline(self):
        self.udpsrc = Gst.ElementFactory.make('udpsrc', 'udpsrc')
        self.udpsrc.set_property("port",5001)
        audioCaps = Gst.Caps.from_string("application/x-rtp")
        self.udpsrc.set_property("caps", audioCaps)

        self.queue = Gst.ElementFactory.make('queue', 'queue')
        

        self.rtppcmudepay = Gst.ElementFactory.make('rtppcmudepay', 'rtppcmudepay')

        self.mulawdec = Gst.ElementFactory.make('mulawdec', 'mulawdec')

        self.audioconvert = Gst.ElementFactory.make('audioconvert', 'audioconvert')
        
        self.autoaudiosink = Gst.ElementFactory.make('autoaudiosink', 'autoaudiosink')
        self.autoaudiosink.set_property('sync', False)

        self.pipeline_A.add(self.udpsrc)
        self.pipeline_A.add(self.queue)
        self.pipeline_A.add(self.rtppcmudepay)
        self.pipeline_A.add(self.mulawdec)
        self.pipeline_A.add(self.audioconvert)
        self.pipeline_A.add(self.autoaudiosink)

        self.udpsrc.link(self.queue)
        self.queue.link(self.rtppcmudepay)
        self.rtppcmudepay.link(self.mulawdec)
        self.mulawdec.link(self.audioconvert)
        self.audioconvert.link(self.autoaudiosink)

##############################################################################
#^
#|
#|
#AUDIO Pipeline
##############################################################################

    def run(self):
        
        self.pipeline.set_state(Gst.State.PLAYING)
        self.pipeline_A.set_state(Gst.State.PLAYING)
        Gtk.main()

    


p = Player()
p.run()
my code run fine in my laptop that has ubuntu but when I want to run it on raspberry pi i receive the following error:

Code: Select all

** (Untitled.py:3561): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .servic
i don't know what am i supposed to do now?

Return to “Graphics, sound and multimedia”