标签: python-gstreamer

如何在虚拟环境中安装python"gi"模块?

我看过这个,并尝试了以下代码:

ln -s /usr/lib/python2.7/dist-packages/pygtk.pth tools/python_2_7_9/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/gobject tools/python_2_7_9/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/gtk-2.0 tools/python_2_7_9/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/pygtk.pth tools/python_2_7_9/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/glib tools/python_2_7_9/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/gi tools/python_2_7_9/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/pygtkcompat tools/python_2_7_9/lib/python2.7/site-packages/
Run Code Online (Sandbox Code Playgroud)

,但import glib还是import gi仍然会产生错误:

yba@ubuntu:~/Documents/XXX/tools$ source python_2_7_9/bin/activate
(python_2_7_9) yba@ubuntu:~/Documents/XXX/tools$ python
Python 2.7.9 (default, Aug 29 2016, 16:04:36) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import glib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/yba/Documents/XXX/tools/python_2_7_9/lib/python2.7/dist-packages/glib/__init__.py", …
Run Code Online (Sandbox Code Playgroud)

python virtualenv python-gstreamer

5
推荐指数
2
解决办法
3894
查看次数

Python-没有名为pygst的模块

我在带有Python 2.7.13的Ubuntu 14.04上使用virtualenv,并且试图开始import pygst工作(我是一个完整的Python新手)。

我下载了:https :
//gstreamer.freedesktop.org/src/gst-python/gst-python-1.12.1.tar.xz

编译并安装有:
./configure --prefix=$VIRTUAL_ENV && make install

但是我仍然不能import pygst

>>> import pygst
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pygst
Run Code Online (Sandbox Code Playgroud)

也没有匹配pygst的pip包。我肯定错过了一些非常简单的东西,但我无法弄清楚。

这也无济于事,因为它仅影响系统Python的安装,而不影响virtualenv:

sudo apt-get install python-gst0.10 gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly
Run Code Online (Sandbox Code Playgroud)

如何使用virtualenv安装pygst?

python ubuntu gstreamer python-gstreamer

5
推荐指数
1
解决办法
4377
查看次数

DrawingArea无法获取XID

我有以下Python 2.7/PyGObject 3.0/PyGST 0.10模块:

from gi.repository import Gtk, Gdk, GdkPixbuf
import pango
import pygst
pygst.require('0.10')
import gst
import Trailcrest
import os, sys
import cairo
from math import pi

class Video:

    def __init__(self):

        def on_message(bus, message): 
            if message.type == gst.MESSAGE_EOS: 
                # End of Stream 
                player.seek(1.0, gst.FORMAT_TIME, gst.SEEK_FLAG_FLUSH, gst.SEEK_TYPE_SET, 5000000000, gst.SEEK_TYPE_NONE, 6000000000)
            elif message.type == gst.MESSAGE_ERROR: 
                player.set_state(gst.STATE_NULL) 
                (err, debug) = message.parse_error() 
                print "Error: %s" % err, debug

        def on_sync_message(bus, message):
            if message.structure is None:
                return False
            if message.structure.get_name() == "prepare-xwindow-id":
                Gdk.threads_enter()
                print …
Run Code Online (Sandbox Code Playgroud)

python gstreamer pygobject python-gstreamer

2
推荐指数
1
解决办法
2800
查看次数

RTMP通过GStreamer和Python

我试图将以下GStreamer命令移植到python程序中:

gst-launch-0.10 -v -m v4l2src ! queue ! ffmpegcolorspace ! queue ! x264enc pass=pass1 threads=0 bitrate=1536 tune=zerolatency ! queue ! flvmux name=mux  pulsesrc ! queue max-size-bytes=134217728 max-size-time=20000000000 max-size-buffers=1000 ! audioconvert ! lame ! audio/mpeg ! queue ! mux. mux. ! queue ! rtmpsink location='rtmp://x.x.x.x/live/myStream'
Run Code Online (Sandbox Code Playgroud)

使用此命令,可以在流式传输到wowza服务器时记录和观看实时流.但我有一些麻烦将此命令移植到python.特别是RTMP接收器似乎会引起麻烦(因为它正在使用filesink):

    self.pipeline = gst.Pipeline("diepipeline")

    self.src = gst.parse_launch("v4l2src")
    self.pipeline.add(self.src)

    self.videoenc = make_bin("(name=videoenc queue ! ffmpegcolorspace ! queue ! x264enc pass=pass1 threads=0 bitrate=1536 tune=zerolatency ! queue )")
    self.pipeline.add(self.videoenc)

    self.audio2src = gst.parse_launch("pulsesrc")
    self.pipeline.add(self.audio2src)

    self.audio2 = make_bin("(name=audio2 queue max-size-bytes=134217728 max-size-time=20000000000 …
Run Code Online (Sandbox Code Playgroud)

python rtmp gstreamer wowza python-gstreamer

2
推荐指数
1
解决办法
3543
查看次数

gstreamer的python绑定:如何导入typelib

我在树莓派上构建了gstreamer最新版本。我想拥有python绑定,因此在编译gstreamer及其插件之前先安装了gobject-introspection-1.0和pygobject-3.18.2。

在gstreamer及其所有插件的构建结束时,我看到了以下文件:

pi@raspberrypi:~/kurento $ ls -ltr /usr/local/lib/girepository-1.0
total 580
-rw-r--r-- 1 root staff 214076 Mar 28 19:28 Gst-1.5.typelib
-rw-r--r-- 1 root staff  43712 Mar 28 19:28 GstBase-1.5.typelib
-rw-r--r-- 1 root staff   6500 Mar 28 19:28 GstController-1.5.typelib
-rw-r--r-- 1 root staff   6272 Mar 28 19:28 GstNet-1.5.typelib
-rw-r--r-- 1 root staff  13116 Mar 28 19:29 GstCheck-1.5.typelib
-rw-r--r-- 1 root staff  14460 Mar 28 20:23 GstTag-1.5.typelib
-rw-r--r-- 1 root staff   2508 Mar 28 20:23 GstFft-1.5.typelib
-rw-r--r-- 1 root staff  27460 Mar 28 20:23 …
Run Code Online (Sandbox Code Playgroud)

gstreamer pygobject python-gstreamer gobject-introspection kurento

2
推荐指数
1
解决办法
1757
查看次数

将opencv帧写入gstreamer rtsp服务器管道

我试图将opencv图像放入python中的gstreamer rtsp服务器.我在mediafactory中写了一些问题,我是gst-rtsp-server ancd的新手,这里有很少的文档,所以我不确切知道我是否使用了正确的方法.我正在使用一个线程来启动MainLoop,我正在使用主线程创建一个缓冲区来推入mediafactory管道的appsrc元素.我使用正确的方法来获得我的目标吗?谁能帮我?我的代码如下:

from threading import Thread
from time import clock

import cv2
import gi

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


class SensorFactory(GstRtspServer.RTSPMediaFactory):
    def __init__(self, **properties):
        super(SensorFactory, self).__init__(**properties)
        self.launch_string = 'appsrc ! video/x-raw,width=320,height=240,framerate=30/1 ' \
                             '! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency ' \
                             '! rtph264pay config-interval=1 name=pay0 pt=96'
        self.pipeline = Gst.parse_launch(self.launch_string)
        self.appsrc = self.pipeline.get_child_by_index(4)

    def do_create_element(self, url):
        return self.pipeline


class GstServer(GstRtspServer.RTSPServer):
    def __init__(self, **properties):
        super(GstServer, self).__init__(**properties)
        self.factory = SensorFactory()
        self.factory.set_shared(True)
        self.get_mount_points().add_factory("/test", self.factory)
        self.attach(None)


GObject.threads_init()
Gst.init(None)

server …
Run Code Online (Sandbox Code Playgroud)

python opencv rtsp gstreamer python-gstreamer

2
推荐指数
1
解决办法
6005
查看次数

gstreamer 中的无缝视频循环

我正在尝试使用 gstreamer 循环播放视频,它是 python 绑定。第一次尝试是挂钩 EOS消息并为管道生成搜索消息:

import gi
gi.require_version("Gst", "1.0")
from gi.repository import Gst

import time

if not Gst.init_check()[0]:
    print("gstreamer initialization failed")

source0 = Gst.ElementFactory.make("filesrc", "source0")
assert source0 is not None
source0.set_property("location", "video0.mp4")

qtdemux0 = Gst.ElementFactory.make("qtdemux", "demux0")
assert qtdemux0 is not None

decoder0 = Gst.ElementFactory.make("nxvideodec", "video_decoder0")
assert decoder0 is not None

def demux0_pad_added(demux, pad):
    if pad.name == 'video_0':  # We expect exactly first one video stream
        pad.link(decoder0.get_static_pad("sink"))

qtdemux0.connect("pad-added", demux0_pad_added)

video_sink = Gst.ElementFactory.make("nxvideosink", "video_sink")
assert video_sink is not None …
Run Code Online (Sandbox Code Playgroud)

python gstreamer python-gstreamer

1
推荐指数
1
解决办法
5588
查看次数