I have a raspberry pi with motion installed. I have a mjpg at localhost:8081 and want to transfer it to an other webserver on the internet, so it's kind of a relay. I don't know where to find the mjpg on the file system for easy transfer, it's not in the configured folder. So, what's the best way to transfer my localhost:8081 to my webserver? It shows the live image of my webcam.

  • Your localhost:8081 is probably motion's stream port: although motion presents it to the web browser as a mjpg file, it's actually relaying live data directly from the camera to the browser. So, do you want to make a snapshot or recording from the camera and transfer that to the webserver, or do you want the webserver to be able to access the webcam and see the live image? – telcoM Apr 14 at 10:37
  • i want to relay the mjpg to my other server on the internet – cli Apr 14 at 10:59

I believe this could be accomplished using ssh. Take a look at forwarding connections over ssh.

ssh -R remote_socket:host:hostport

If, for example, your webserver is example.com:

ssh -R 8081:localhost:8081 example.com

When run on your raspberry pi, will forward all connections pointed to port 8081 on your webserver over ssh to your raspberry pi.

I recommend trying this using another host on your LAN first to see if it meets your needs. From the raspberry pi:

ssh -R 8081:localhost:8081 other_lan_host

Alternatively, you can use the -L option and run the command from the LAN host that you are testing with:

ssh -L 8081:raspberrypihost:8081

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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