Let me explain my problem: I have 2 webcams looking out over the beach but my internet connection is very slow. So i'm looking for a way to buffer the videofeed to a server and then let my clients connect to that server instead of directly to the webcams.

2 Answers 2


Here's something I saw at github might answer your question.

This example demonstrate how to encode set of buffered images obtained from Webcam instance, transcode into h.264 stream and send to remote peer where it is decoded and rendered in panel.

Example provided by hepin1989. Thank you! This is wonderful piece of the good code :)

How To Use

  1. Run StreamServer - this will open the webcam device and start listening for incoming streaming requests.
  2. Run StreamClient - this will connect to the StreamServer and start displaying image from the remote camera. The server / client address is localhost by default to run client and server on the same machine, but if you want to stream over the network, you need to change it to reflect your real IP address (server must bind to eth0 instead of lo interface to be visible from the NAT).


  1. The code supports sunny-day scenario only, just to demonstrate the idea, so there are is no complex error checking statements and the code may behave in unexpected manner when launched in real network.
  2. It uses Xuggler which seems to be discontinued.
  3. Remember, this example is to present an idea, so if you need enhancement or bug fix, please implement it and send pull request to share it with community. Be creative :)
  4. To perform streaming over the network you need to change address in server from localhost to your real IP address (e.g. such as or in general). I'm not sure how it works with the IPv6 support - feel free to test it.

her is the link- https://github.com/sarxos/webcam-capture/tree/master/webcam-capture-examples/webcam-capture-live-streaming


Livestream does this. It's built in, in terms of functionality of a drift buffer.

Basically, the buffer does not "exist", until time passes, and it grows, as time passes.

So after X min of feed in, it has only fed out X * 0.9995 of the stream. The speed of the program feed from a viewers perspective, in terms of the fact they are not actually watching it at 100% speed, is too small to notice. But over minutes, hours, etc, it adds up to a decent buffer, to where the live vs program can be minutes or more apart.

I believe livestream has a free option. Also youtube offers streaming now. I would not be surprised if they have this also built in.

Hope this helps.

  • I understand but my question is more the internet connetion to the location is very bad. So i want to upload the stream from the 2 webcams to a server so that server can then server the stream to the visitors of my site. At the moment i show the livefeed from the webcam direct to the visitors. SO when 3 or 4 poeple watch at the same time... lets say the frame rate drops to 1 frame every hour. Dec 9, 2016 at 15:12
  • @JelleDijkhuizen, with Livestream, YouTube streaming, or Facebook Live, you stream the web cam to the services servers and then viewers connect to the servers. The number of viewers won't impact your connection to the service. Dec 9, 2016 at 23:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.