Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I used gstreamer on the server (running voyage linux). This was part of a larger script that did some tests to make sure the camera was present and setup the client host IP dynamically. My ROV was actually a DHCP server, so it assigned the client's IP, but these snippets work without all that complexity.
- $ gst-launch v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,framerate=30/1 ! ffmpegcolorspace ! jpegenc ! tcpserversink host=192.168.1.6 port=35890
- You can easily test this on a client with this command. Here "host" is the server IP
- $ gst-launch tcpclientsrc host=192.168.1.1 port=35890 ! jpegdec ! autovideosink
- The actual client was a python/GTK application, here's the relevant code:
- You'll need gobject, gtk, and pygst. See the gstpython site for more documentation:
- http://gstreamer.freedesktop.org/modules/gst-python.html
- class RovGui():
- def __init__(self):
- # snip #
- # setup remote camera stream
- self.player = gst.parse_launch("tcpclientsrc host=" + self.rov_server_ip + " port=35890 ! jpegdec ! autovideosink")
- bus = self.player.get_bus()
- bus.add_signal_watch()
- bus.enable_sync_message_emission()
- bus.connect("message", self.on_message)
- bus.connect("sync-message::element", self.on_sync_message)
- self.player.set_state(gst.STATE_PLAYING)
- # handle messages coming from video thread
- def on_message(self, bus, message):
- t = message.type
- if t == gst.MESSAGE_EOS:
- self.player.set_state(gst.STATE_NULL)
- elif t == gst.MESSAGE_ERROR:
- err, debug = message.parse_error()
- print "Error: %s" % err, debug
- self.player.set_state(gst.STATE_NULL)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement