Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Gstreamer的Python3错误_Python_Gstreamer - Fatal编程技术网

使用Gstreamer的Python3错误

使用Gstreamer的Python3错误,python,gstreamer,Python,Gstreamer,我运行: 在覆盆子皮上跑步: 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 在我的电脑上。我收到了来自Raspberry的视频流。 现在,我想在我的计算机中编写一个py

我运行:

在覆盆子皮上跑步:

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
在我的电脑上。我收到了来自Raspberry的视频流。 现在,我想在我的计算机中编写一个python代码来实现这一点。我的代码是:

gst-launch-1.0 -v tcpclientsrc host=serverIp port=5000 \! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false
但我得到了以下错误:

(DO.py:3618):GStreamer警告**: gstpad.c:4555:store\u sticky\u事件:sticky事件 订购错误,在“caps”之前有“segment”

(DO.py:3618):GStreamer警告**: gstpad.c:4555:store\u sticky\u事件:sticky事件 订购错误,在“caps”之前有“segment”

致以最良好的祝愿,
Mostafa

我回答了我的问题:我替换了这个代码:

#!/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):

        self.pipeline = Gst.Pipeline()

        self.tcpsrc = Gst.ElementFactory.make('tcpclientsrc','tcpsrc')
        self.tcpsrc.set_property("host",'192.168.1.12')
        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('appsink', '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)
    def run(self):
        self.pipeline.set_state(Gst.State.PLAYING)

p = Player()
p.run()
首先,我忘了将
Gtk.main()
添加到
run
函数中。 第二,我将
self.asink=Gst.ElementFactory.make('appsink','asink')
更改为
self.asink=Gst.ElementFactory.make('autovideosink','asink')

#!/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):

        self.pipeline = Gst.Pipeline()

        self.tcpsrc = Gst.ElementFactory.make('tcpclientsrc','tcpsrc')
        self.tcpsrc.set_property("host", '192.168.1.13')
        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)

    def run(self):

        self.pipeline.set_state(Gst.State.PLAYING)
        Gtk.main()

p = Player()
p.run()