[gst-devel] repeated use of pngenc
Nawal <Galileon> Husnoo
galileon at gmail.com
Sat Apr 18 18:49:19 CEST 2009
Dear all,
I'm starting out with Gstreamer in Python, and I've been playing with some
code I found on a website, trying to get a picture from my webcam to be
saved as a PNG in /dev/shm. It's working, but I would like to have regular
updates of the image, such as 12 frames per second or something. However, my
code is only producing a single image, and then doesn't do much:
# Set up the gstreamer pipeline
self.player = gst.parse_launch ("v4l2src device="+devname+
" !
video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! pngenc ! filesink
location=/dev/shm/test.png")
# ffmpegcolorspace ! pngenc ! filesink location=/dev/shm/test.png")
# old sink was: autovideosink")
bus = self.player.get_bus()
bus.add_signal_watch()
bus.enable_sync_message_emission()
bus.connect("sync-message::element", self.on_sync_message)
self.player.set_state(gst.STATE_PLAYING)
def on_sync_message(self, bus, message):
if message.structure is None:
return
message_name = message.structure.get_name()
if message_name == "prepare-xwindow-id":
# Assign the viewport
imagesink = message.src
imagesink.set_property("force-aspect-ratio", True)
imagesink.set_xwindow_id(self.movie_window.window.xid)
Please note it still has some remnants of the code that overlayed the image
in a GTK window. Any ideas how I can make it update the png regularly
please?
Thanks,
Nawal
--
The best way to predict the future is to invent it. - Alan Kay
http://www.galileon.co.uk/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090418/68444d60/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: webcam-stream-sat-18-apr-2009.17.17.py
Type: text/x-python
Size: 2727 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090418/68444d60/attachment.py>
More information about the gstreamer-devel
mailing list