标签: gstreamer

使用GStreamer播放传入的RTP流

我正在开发一个GStreamer应用程序,并为实现传入RTP流的播放器而苦苦挣扎.我正在尝试围绕gstrtpbin元素构建一个管道.我正在尝试使用gst-launch构造对管道进行建模:

VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"

gst-launch -v udpsrc caps=$VIDEO_CAPS port=4444 \
              ! gstrtpbin .recv_rtp_sink_0 \
              ! rtph264depay ! ffdec_h264 ! xvimagesink
Run Code Online (Sandbox Code Playgroud)

当我启动脚本时,GStreamer报告这些错误:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0: ntp-ns-base = 3469468914024449000
New clock: GstSystemClock
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:recv_rtp_sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_sink_0: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_sink_0.GstProxyPad:proxypad0: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:recv_rtp_src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSsrcDemux:rtpssrcdemux0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264 …
Run Code Online (Sandbox Code Playgroud)

video-streaming gstreamer

8
推荐指数
1
解决办法
4万
查看次数

使用GStreamer将视频转换为WebM

GStreamer的文档令人困惑.这仍然是诉诸StackOverflow.com的借口,但仍然是:

什么是将任何视频文件(从任何格式)转换为WebM(+ WebM音频)的GStreamer命令行?

这是我能找到的唯一文档.

我被困在某个地方 gst-launch-0.10 webmmux name=mux ! filesrc location=oldfile.ext ! filesink location=newfile.webm ! name=demux ! demux. ! ffmpegcolorspace ! vp8enc ! queue ! mux.video_0 ! demux. ! progressreport ! audioconvert ! audiorate ! vorbisenc ! queue ! mux.audio_0

WARNING: erroneous pipeline: link without source element知道如何让这件事情继续下去.

这非常令人沮丧.

请帮忙,谢谢.:)

video video-encoding gstreamer webm

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

将一些OpenCV处理添加到gstreamer视频流

我正在尝试让OpenCV在一个gstreamer管道中间处理一个框架.

我有一个gstreamer管道生成流,将其发送到appsink以获取OpenCV代码:

v4l2src ! ffmpegcolorspace ! jpegenc ! appsink name=sink
Run Code Online (Sandbox Code Playgroud)

另一个管道从appsrc(OpenCV发送数据)获取它并在屏幕上输出:

appsrc name=src ! jpegdec ! xvimagesink
Run Code Online (Sandbox Code Playgroud)

我在接收器上打开每个帧的拉缓冲器请求并使用OpenCV处理它,然后在src上使用push-buffer.我正在用Python做所有这些.

出于某种原因,这似乎不起作用(分段错误).

但我并没有真正想要解决它; 无论如何,它的效率非常低.我只是想知道是否有更好的方法让OpenCV在到达输出接收器之前处理帧?

python opencv gstreamer

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

gstreamer udp流媒体很慢

我正在研究视频应用程序,但遇到UDP流与TCP的问题.

当我使用下面的管道时,视频流可以接受.(应用程序本身是python,但管道基本上如下)

sender: 

gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=320,height=240 ! 
    theoraenc ! oggmux ! tcpclientsink host=nnn.nnn.nnn.nnn port = 5000

receiver: 

gst-launch-0.10 tcpserversrc host=nnn.nnn.nnn.nnn port=5000 
    ! decodebin ! xvimagesink
Run Code Online (Sandbox Code Playgroud)

但是,由于这个应用程序要跨越/通过NAT执行,我需要UDP流.当我将tcpserversrc切换为"udpsrc port = 5000"并将tcpclientsink切换为"udpsink host = nnn.nnn.nnn.nnnn port = 5000"时,性能急剧下降到接收计算机每5秒获取一个帧的程度或者.(即使两个流在同一台机器上执行,也会发生这种情况)

发送管道生成以下(一次):

WARNING: from element /GstPipeline:pipeline0/GstUDPSink:udpsink0: 
    Internal data flow problem.
    Additional debug info:
    gstbasesink.c(3492): gst_base_sink_chain_unlocked (): /GstPipeline:pipeline0
    /GstUDPSink:udpsink0:
    Received buffer without a new-segment. Assuming timestamps start from 0.
Run Code Online (Sandbox Code Playgroud)

...并且接收管道生成(每20秒左右):

WARNING: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0: 
    A lot of buffers are being dropped.
    Additional debug info:
    gstbasesink.c(2739): gst_base_sink_is_too_late …
Run Code Online (Sandbox Code Playgroud)

streaming udp video-streaming gstreamer

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

Gstreamer - 将命令行gst-launch转换为C代码

我一直在使用gst-launch实用程序对GStreamer进行一些实验.但是,最终目标是使用GStreamer库在我自己的应用程序上实现相同的功能.

问题是,最终很难(至少对于那些不习惯使用GStreamer API的人来说)将我在命令行上测试的内容"移植"到C/C++代码.

我可能需要移植的命令示例如下:

gst-launch filesrc location="CLIP8.mp4" ! decodebin2 ! jpegenc ! multifilesink location="test%d.jpg"
Run Code Online (Sandbox Code Playgroud)

什么是最"直接"的方式/方法来获取这样的命令并在我自己的应用程序上用C语言编写它.

另外,作为一个附带问题,我怎么能用在内存上做这项工作的可能性替换multifilesink(我正在使用OpenCV对应该从视频中提取的给定图像执行一些计算).是否可以直接解码到内存并立即使用它而无需先保存到文件系统?它可以(并且应该)是顺序的,我的意思是在我完成处理当前帧之后只会继续到下一帧,这样我就不必在内存中保留数千帧.

你说什么?

c c++ opencv extract gstreamer

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

Python无法使用Gstreamer访问usb麦克风,在Raspberry Pi上使用Pocketsphinx进行语音识别

因此,蟒蛇的表现就像是从我的麦克风根本听不到任何东西.

这是问题所在.我有一个Python(2.7)脚本,假设使用Gstreamer访问我的麦克风并通过Pocketsphinx为我做语音识别.我正在使用Pulse Audio,而我的设备是Raspberry Pi.我的麦克风是Playstation 3 Eye.

现在,我已经获得了pocketphinx_continuous以正确运行并识别我在.dict和.lm文件中定义的单词.经过几次试运行后,准确度大约为85-90%.所以,我知道我的麦克风通常通过pocketsphinx +脉冲音频拾取声音.

仅供参考我执行以下操作:

pocketsphinx_continuous -lm /home/pi/dev/scarlettPi/config/speech/lm/scarlett.lm -dict /home/pi/dev/scarlettPi/config/speech/dict/scarlett.dic -hmm /home/pi/dev/scarlettPi/config/speech/model/hmm/en_US/hub4wsj_sc_8k -silprob  0.1 -wip 1e-4 -bestpath 0
Run Code Online (Sandbox Code Playgroud)

在我的python代码中,我试图做同样的事情,但我正在使用gstreamer访问python中的麦克风.(注意:我对Python有点新鲜)

这是我的代码(感谢Josip Lisec让我这么远):

import pi
from pi.becore import ScarlettConfig
from recorder import Recorder
from brain import Brain

import os
import json
import tempfile
#import sys

import pygtk
pygtk.require('2.0')
import gtk
import gobject
import pygst
pygst.require('0.10')
gobject.threads_init()
import gst

scarlett_config=ScarlettConfig()

class Listener:
  def __init__(self, gobject, gst):
    self.failed …
Run Code Online (Sandbox Code Playgroud)

python speech-recognition gstreamer pulseaudio cmusphinx

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

实时/零延迟视频流:要使用哪些编解码器参数?

我正在编写一个Android应用程序,其中包括从台式PC发送和接收视频流.为了使应用程序正常工作,我们需要尽可能少的延迟,必要时牺牲视频质量.我们正在gstreamer 1.45两端使用,但是对于当前的管道,我们在Galaxy Note S2上至少有0.5秒的延迟,那就是两个设备都在同一网络上(后来这应该通过VPN工作).

发件人管道

appsrc name=vs_src format=time do-timestamp=true
    caps="video/x-raw, format=(string)RGB, width=(int)640, height=(int)480, framerate=(fraction)15/1000" 
    ! videoconvert 
    ! x264enc speed-preset=ultrafast tune=zerolatency byte-stream=true threads=1 key-int-max=15 intra-refresh=true ! h264parse ! rtph264pay pt=96
    ! queue ! udpsink name=vs_sink host=%s port=%d async=false
Run Code Online (Sandbox Code Playgroud)

接收器管道

udpsrc name=vr_src 
    caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, payload=(int)96, encoding-name=(string)H264"
    ! rtpjitterbuffer 
    ! rtph264depay ! h264parse ! avdec_h264 
    ! videorate ! videoconvert
    ! glimagesink name=vr_sink async=false
Run Code Online (Sandbox Code Playgroud)

设置threads=2或更高会发出gstreamer警告,表明它是在没有多线程支持的情况下编译的.我知道有些设备提供硬件解码器,但可靠地访问它们的唯一方法似乎是通过encodebin/ decodebin.我已经尝试使用decodebin但由于某种原因它抱怨它无法找到所需的插件(例如No decoder to handle …

android video-streaming gstreamer h.264

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

没有可用于类型“video/x-h264”的解码器

我正在尝试在不进行任何修改的情况下运行 qt 示例应用程序之一。它被称为player,它是一个多媒体小部件演示。我的系统是 Ubuntu 16.04 64 位。当我尝试播放视频时,我在控制台中看到以下错误:

No decoder available for type 'video/x-h264

这是尝试两个不同视频后的完整错误:

Starting /home/aras/Qt5.7.0_Sept2016/Examples/Qt-5.7/multimediawidgets/build-player-Sept2016-Debug/player...
Warning: "No decoder available for type 'video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)constrained-baseline, codec_data=(buffer)0142e01eff0100192742e01ea9101405ff2e00d418041adb7a00f480f55ef7c04001000428de09c8, width=(int)640, height=(int)360, framerate=(fraction)2997/125, pixel-aspect-ratio=(fraction)1/1'."
Warning: "No decoder available for type 'video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)constrained-baseline, codec_data=(buffer)0142e01eff0100192742e01ea9101405ff2e00d418041adb7a00f480f55ef7c04001000428de09c8, width=(int)640, height=(int)360, framerate=(fraction)2997/125, pixel-aspect-ratio=(fraction)1/1'."
Warning: "No decoder available for type 'video/x-h264, stream-format=(string)avc, pixel-aspect-ratio=(fraction)1/1, width=(int)1280, height=(int)720, framerate=(fraction)601600/10033'."
Run Code Online (Sandbox Code Playgroud)

我几乎安装了与 gstreamer 远程相关的所有软件包。当我运行时,gst-inspect-1.0我得到了很多输出,最后一行是:

Total count: 241 plugins (1 blacklist entry not shown), 1388 features

~$ gst-inspect-1.0 …
Run Code Online (Sandbox Code Playgroud)

video gstreamer h.264 qt5 qtmultimedia

8
推荐指数
2
解决办法
9081
查看次数

Gstreamer webrtcbin 工作示例管道

有人可以显示最新的 webrtcbin 管道吗?目前我使用这些管道,但它们不起作用。

发送:

gst-launch-1.0 webrtcbin bundle-policy=max-bundle name=sendrecv  stun-server=stun://stun.l.google.com:19302 audiotestsrc is-live=true wave=red-noise ! audioconvert ! audioresample ! queue ! opusenc ! rtpopuspay ! application/x-rtp,media=audio,encoding-name=OPUS,payload=97 ! sendrecv.
Run Code Online (Sandbox Code Playgroud)

收到:

gst-launch-1.0 webrtcbin bundle-policy=max-bundle name=sendrecv  stun-server=stun://stun.l.google.com:19302 ! rtpopusdepay ! opusdec ! audioconvert ! autoaudiosink async=false
Run Code Online (Sandbox Code Playgroud)

谢谢!!!

gstreamer python-gstreamer webrtc gstreamer-1.0

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

Gstreamer-如何用多个src构建应用程序?

在这种情况下,我有多个摄像头(rtspsrc)和一个singleton元素,它们对传入的视频流进行分析。我称它为单例元素,因为它具有请求源和接收器垫。应用程序中应该只存在其中之一,因为它可以在GPU上运行,并且可以通过批量处理获得更好的性能。将我正在构建的应用程序视为API,以添加相机,移除相机,打开和关闭每个相机的分析等。相机将对其进行分析,捕获结果并继续发送。麻烦的是,我需要共享一个Gstreamer元素(分析元素)。

因此,我有多个摄像头,将其馈入单个元素,然后馈入至appsink。这相当有效,但我希望能够:

  • 暂停特定的相机
  • 将每一个rtspsrc都完全隔离,这样一个错误就不会影响整个管道
  • 监听特定摄像机上的事件

如果我将所有摄像机都放在管道中,则无法弄清楚如何暂停特定摄像机。我无法暂停整个管道,因为这将停止所有摄像机。我想出的最好办法是删除并与特定摄像机的元素不同,然后在恢复时重新添加并重新链接。这有点。如果某个特定对象rtspsrc停止响应,则整个管道都将停止。如果rtspsrc不存在特定内容,则整个管道不会过渡到PLAYING状态

我应该如何设计我的应用程序?您认为我应该只有一条大型管道吗?还是应该有一个包含单例分析元素的管道,以及每个摄像机的管道,然后使用appsink和appsrc将它们连接起来?这种方法可能会使处理事情变得更容易,因为每个管道都是完全独立的?

让我知道您是否需要更多信息。

architecture video gstreamer

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