[gst-devel] streaming video - network camera help!
Rohan
rohan at perzonae.com
Thu Nov 26 09:09:24 CET 2009
Stefan Kost wrote:
> Rohan schrieb:
>> Shear, Greg wrote:
>>> I have a network camera (this one:
>>> http://www.axis.com/products/cam_2120/ ) plugged into my home LAN. I can
>>> check out its IP with my web browser and see the video. Cool.
>>>
>>> I'd like to write a little app to receive that video stream and do some
>>> processing/remapping of the pixels. I've had a couple people recommend
>>> gstreamer to get access to the video stream. I'm looking some
>>> suggestions about where to start; some simple demo code would be great.
>>
>> Hi Greg. I am wrestling with this at the moment. For many things I
>> have found the gstreamer library fabulous. Personally I use the
>> python bindings, and use gst-launch for all my pipeline testing.
>>
>> It sounds like what you want to do is not something supplied by one of
>> the many plugins, in which case you are going to want to use
>> appsink/appsrc which is what I am using at the moment.
>
> I would also recommend to try writing and own plugin. If you e.g. use
> VideoFilter as a baseclass, there is really not much that you need to implement
> besides the actually proceessing function.
>
> Not sure is videofilter is wrapped under the python bindings. Check with bilboed
> on irc. Writing a video filter in python is probably not the best idea in terms
> of performance, but should work for prototyping.
Wow, this is a great tip. To be honest I had been avoiding it,
because it looked quite intimidating. As for performance, getting a
prototype working in python at least lets you see how to do it. From
there it should be pretty fast and easy to translate to c.
Thanks for the tip. I am still going to post a question to my
immediate problem. ;)
Rohan
Btw. Here is the synchronous script that does works at this point.
------------------------------------------------------------------------
#!/usr/bin/env python
import pygst
pygst.require("0.10")
import gst
# import gobject
class client(object):
def __init__(self):
self.buffers = []
pipeline = gst.parse_launch('''audiotestsrc name=testsrc !
decodebin ! audio/x-raw-int !
audioconvert ! vorbisenc name=vorbisenc ! appsink name=sink
sync=False''')
sink = pipeline.get_by_name('sink')
pipeline2 = gst.parse_launch(''' appsrc name=source !
vorbisdec ! audioconvert ! alsasink''')
source = pipeline2.get_by_name("source")
pipeline.set_state(gst.STATE_PLAYING)
pipeline2.set_state(gst.STATE_PLAYING)
while True:
try:
# print "PULL BUFFER"
buf = sink.emit('pull-buffer')
self.buffers.append(buf)
if self.buffers:
source.emit('push-buffer', self.buffers.pop(0))
except SystemError, e:
# it's probably a bug that emits triggers a SystemError
print 'SystemError', e
break
if __name__ == "__main__":
client()
------------------------------------------------------------------------
More information about the gstreamer-devel
mailing list