gstreamerバインディングを使用してPythonで画像を表示したいのですが、GTK +を使用していません(私はARMを使用しています)。gtkを表示しない画像を表示
私はPythonとのgstreamerで音楽を聴く方法を知っている:
#!/usr/bin/python
# Simply initiates a gstreamer pipeline without gtk
import gst
import gobject
import sys
mainloop = gobject.MainLoop()
my_bin = gst.element_factory_make("playbin")
my_bin.set_property("uri", "file:///home/Lumme-Badloop.ogg")
my_bin.set_state(gst.STATE_PLAYING)
try:
mainloop.run()
except KeyboardInterrupt:
sys.exit(0)
私は、コマンドラインでのGStreamerで画像を表示する方法を知っている:私はしたいと思う何
gst-launch-0.10 filesrc location=image.jpeg ! jpegdec ! freeze ! videoscale ! ffmpegcolorspace ! autovideosink
が正確です同じことですが、Pythonを使用しています。
私はいくつかのことを試しましたが、コードはエラーなしで実行されますが、画面には何も表示されません。
pipe = gst.Pipeline("mypipe")
source = gst.element_factory_make("filesrc", "filesource")
demuxer = gst.element_factory_make("jpegdec", "demuxer")
freeze = gst.element_factory_make("freeze", "freeze")
video = gst.element_factory_make("videoscale", "scaling")
ffm = gst.element_factory_make("ffmpegcolorspace", "muxer")
sink = gst.element_factory_make("autovideosink", "output")
pipe.add(source, demuxer, freeze, video, ffm, sink)
filepath = "file:///home/image.jpeg"
pipe.get_by_name("filesource").set_property("location", filepath)
pipe.set_state(gst.STATE_PLAYING)
あなたは私を助けることができると思いますか?
ありがとうございました!
ところで、私はまたaudiotestとvideotest働いています。ここでは正常に実行例を次に示します。
# Create GStreamer pipeline
pipeline = gst.Pipeline("mypipeline")
# Set up our video test source
videotestsrc = gst.element_factory_make("videotestsrc", "video")
# Add it to the pipeline
pipeline.add(videotestsrc)
# Now we need somewhere to send the video
sink = gst.element_factory_make("xvimagesink", "sink")
# Add it to the pipeline
pipeline.add(sink)
# Link the video source to the sink-xv
videotestsrc.link(sink)
pipeline.set_state(gst.STATE_PLAYING)
あなたは 'xvimagesink'や' ximagesink'のような他のシンクを試しましたか? – jcollado
私は、この瞬間にいました。私はvideosinkの実例を得ました。私は私のポストの終わりにそれを置いた。助けてくれてありがとう – jlengrand
@jlengrand:あなた自身の質問に答えてこれを閉じることができます。そのような状況をどのように処理するのが普通です。 – Will