के बिना चित्र प्रदर्शित करें मैं जीस्ट्रीम बाइंडिंग का उपयोग कर पाइथन में एक छवि प्रदर्शित करना चाहता हूं, लेकिन जीटीके + (मैं एआरएम पर हूं) का उपयोग किए बिना।gtk
मुझे पता है कि अजगर और 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
मैं क्या चाहते हो जाएगा सटीक है एक ही बात है, लेकिन पाइथन का उपयोग कर।
मैंने कुछ चीजों की कोशिश की, कोड त्रुटियों के बिना चलता है, लेकिन स्क्रीन पर कुछ भी नहीं दिखाता है।
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)
क्या आपके पास कोई विचार है जो मेरी मदद कर सकता है?
अग्रिम धन्यवाद!
वैसे, मेरे पास ऑडिओटेस्ट और वीडियोटेस्ट काम भी है। यहाँ एक उदाहरण है कि ठीक चलाता है:
# 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
मैं इस पल में था। मुझे वीडियो सिंक के साथ एक कामकाजी उदाहरण मिला। मैंने इसे अपनी पोस्ट के अंत में रखा। मदद – jlengrand
@jlengrand के लिए धन्यवाद: आप अपने प्रश्न का उत्तर दे सकते हैं और इसे बंद कर सकते हैं। यह सामान्य रूप से हम इस तरह की स्थितियों को कैसे संभालेंगे। – Will