简体   繁体   English

Gstreamer管道动态更改Python

[英]Gstreamer Pipeline Dynamic Change Python

I have been trying to dynamically change the gstreamer pipeline but it just stops the stream as soon as I change the state. 我一直在尝试动态更改gstreamer管道,但只要更改状态,它就会立即停止流。 What is it that I am doing wring here. 我在这儿干什么。 Here is my code : 这是我的代码:

#!/usr/bin/python
import gobject
import time

gobject.threads_init()
import pygst

pygst.require("0.10")
import gst

p = gst.parse_launch("""filesrc location=/home/jango/Pictures/4.jpg name=src1 ! decodebin ! queue ! videoscale ! ffmpegcolorspace !
imagefreeze ! capsfilter name=vfps caps="video/x-raw-yuv, framerate=60/1, width=640, height=420" ! theoraenc ! oggmux name=mux ! filesink location=1.ogg""")

p.set_state(gst.STATE_PLAYING)
time.sleep(10)
print "State change"
p.set_state(gst.STATE_READY)
source = p.get_by_name("src1")
source.set_property("location", "/home/jango/Pictures/2.jpg")
p.set_state(gst.STATE_PLAYING)
gobject.MainLoop().run()

Please suggest me if there is any alternative methods or any tutorials which I can refer to. 如果可以参考其他替代方法或教程,请提出建议。 Thanks in advance. 提前致谢。

using Gstreamer-Editing-Services might be an option, it will handle all the pipeline rewiring for you, with a higher level API than GStreamer. 使用Gstreamer-Editing-Services可能是一个选择,它将为您处理所有管道重新布线,并提供比GStreamer更高级别的API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM