Yet Another Cycling Forum

General Category => The Knowledge => Ctrl-Alt-Del => Topic started by: Russell on 10 April, 2021, 04:37:01 pm

Title: Webcam Stream URL
Post by: Russell on 10 April, 2021, 04:37:01 pm
I've got a Logitech C270 webcam which connects USB to my laptop.  I can see the output of it in various programs (apps) on the laptop.

I am using a web based app to monitor my 3D printer and it can log the webcam on it.  It is asking for a stream URL for the camera.  It says it needs to be reachable from the browser displaying the 3D printer UI.

How, what , where, when etc?

Help please.

R
Title: Re: Webcam Stream URL
Post by: Kim on 10 April, 2021, 05:30:31 pm
You need some sort of software to turn the camera into a, well, webcam.  There's probably some horrible Logitech application for the purpose.  Or possibly not, given that they assume everyone's behind NAT and will presumably be streaming using Youtube or similar.

I bet VLC can do it...
Title: Re: Webcam Stream URL
Post by: grams on 10 April, 2021, 05:33:52 pm
The utility for this (Octoprint) on Linux is called mjpgstreamer. There appears to be a Windows version.
Title: Re: Webcam Stream URL
Post by: Russell on 10 April, 2021, 06:02:01 pm
Looks like mpg streamer is on the windows store!

Ta muchly.
Title: Re: Webcam Stream URL
Post by: Russell on 10 April, 2021, 06:15:31 pm
OK, got it and I can see the webcam on it, but the only thing I can see on the app that looks like streaming is HTTP server port 8000.  There's nothing else that gives me a clue what to do next.

Looks like this:

(https://store-images.s-microsoft.com/image/apps.25705.14065301039530826.2c3f43e9-00c3-4f55-bddb-f2a0af176b45.4d8420c8-4ad6-4daf-b79a-89bff6ac9ba3?w=672&h=378&q=80&mode=letterbox&background=%23FFE4E4E4&format=jpg)
Title: Re: Webcam Stream URL
Post by: Kim on 10 April, 2021, 06:32:42 pm
Try http://localhost:8000
Title: Re: Webcam Stream URL
Post by: grams on 10 April, 2021, 07:34:49 pm
Mine is http://localhost:8000/?action=stream for the streaming and http://localhost:8000/?action=snapshot for the time lapse.
Title: Re: Webcam Stream URL
Post by: Russell on 11 April, 2021, 10:16:33 am
I'm afraid that doesn't work.  I assume if I type localhost:8000 etc into the browser I should see the camera?

I was wondering if I need to do anything like this:

https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server (https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server)

https://stackabuse.com/serving-files-with-pythons-simplehttpserver-module/ (https://stackabuse.com/serving-files-with-pythons-simplehttpserver-module/)

Thanks for your help so far.
Title: Re: Webcam Stream URL
Post by: grams on 11 April, 2021, 10:30:05 am
I'm afraid that doesn't work.  I assume if I type localhost:8000 etc into the browser I should see the camera?

You should see *something* when you go to that address while the MJPG streamer thing is running, even if it's just an error page or what have you.
Title: Re: Webcam Stream URL
Post by: Feanor on 11 April, 2021, 10:36:08 am
I'm afraid that doesn't work.  I assume if I type localhost:8000 etc into the browser I should see the camera?

Using a browser on the same machine which the streamer is running on, then yes you should see *something*.

If you are not, then I'd guess it's a windows firewall issue.
Did the installer say anything about creating a rule in the firewall?
If it didn't, then I expect you will need to do this manually.

You will need to create an inbound rule to permit the connection.
You can create a rule for either the port ( TCP, 8000 ), or the program ( you need to know exactly what .exe to point it at ).
I'd probably specify the rule by port number.

https://www.tomshardware.com/uk/news/how-to-open-firewall-ports-in-windows-10,36451.html
Title: Re: Webcam Stream URL
Post by: Russell on 11 April, 2021, 11:56:45 am
Thanks but I'm struggling here.  Looks like I have AVG protecting me and Windows says the firewall is being looked after by AVG.

Still trying to work my way through the setups.
Title: Re: Webcam Stream URL
Post by: Feanor on 11 April, 2021, 12:56:07 pm
Thanks but I'm struggling here.  Looks like I have AVG protecting me and Windows says the firewall is being looked after by AVG.

Still trying to work my way through the setups.

In that case, the installer will almost certainly not have set up any kind of exception in the AVG firewall.

You will need to create an exception in the AVG firewall for TCP port 8000.

From a quick Google, this might be where to start:
https://support.avg.com/SupportArticleView?l=en&urlName=AVG-Antivirus-Enhanced-Firewall-Packet-Rules&q=How+to+block+or+allow+IP+addresses+in+Firewall&supportType=home

Scroll down to the section on Customise Packet Rules, and follow the instructions to Add a new packet rule.

The screenshot doesn't show everything ( there's a horizontal scroll bar ), but based on the description of the rules further up the page, I'd try:

Enter a name, eg 'Streamer'
Action: Allow
Protocol: TCP(6)
Direction: In
Address: Leave blank ( all addresses )
Local Port: 8000
Remote port: Leave blank ( accept from any source port )
ICMP type: Leave blank ( not applicable, this is not an ICMP rule )
Profile: All ( this rule will be applied to all firewall profiles )


Title: Re: Webcam Stream URL
Post by: Russell on 11 April, 2021, 04:18:04 pm
Sorry for the delay I was painting a banister!

Followed the procedure easily enough but no joy with localhost:8000 in the browser.  Eventually it returns timed out taking too long.
Title: Re: Webcam Stream URL
Post by: Lightning Phil on 11 April, 2021, 04:29:47 pm
Turn off AVG then try it again. If it works it’s your anti virus package.
Title: Re: Webcam Stream URL
Post by: Russell on 14 April, 2021, 02:42:37 pm
Apologies for the lack of response but MPG Streamer has stopped working, just opens and immediately closes again, so I haven't looked into this any further.  A fresh install is probably called for.