Here is part two of the story of the Wrt160NL router. I want to use my old webcam to stream some video through the router.
I have a Linksys WRT160NL router, and the last time I reflashed it’s firmware with OpenWrt
A Canyon Cn-wcam23 webcam
After consulting with my friend(google) I have found the best software for this: mjpeg-streamer.
First I had to install these packages:
for the Canyon Cn-wcam23 webcam, the driver:
At this point I tell that this wasn’t so smooth, I didn’t know I had to install the driver for my webcam, it took 4 hours to realise it. The documents that I had read, didn’t tell me this little thing, but after some research I have found this solution.
For debug you can install these package:
Here is a example what you might see:
– Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub ; this is the router USB connector
– Bus 001 Device 008: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 009: ID 05e3:0722 Genesys Logic, Inc. ; these two my usb hub
– Bus 001 Device 010: ID 13fe:1a00 Kingston Technology Company Inc. 512MB/1GB Flash Drive; this is my Kingston pendrive, and it’s size is 2 gb.
– Bus 001 Device 011: ID 0ac8:301b Z-Star Microelectronics Corp. ZC0301 Webcam ; and this is the webcam.
So you can see, if everything is ok, then you can see the webcam in the usb list.
Back to the next step:
So we can see the webcam in the usb list, next we have to look if OpenWrt can see webcam in the devices.
We have to go to /dev .
As we can see there is a video0, it means the OpenWRT recognises the webcam.
Now the only thing left is to configure mjpeg-streamer.
The config file is located at /etc/config/mjpeg-streamer.
We have to edit the mjpeg-streamer file, if we want some change. The files data should look like this:
config mjpg-streamer core
option device “/dev/video0” <= the device path
option resolution "640×480" <= the webcam resulution
option fps "5" <= the frame per sec
option port "8080" <= the port that used for the stream
option enabled "true" <= it's enabled or disabled
And I edited it to be like this:
config mjpg-streamer core
option device "/dev/video0"
option resolution "640×480"
option fps "15"
option port "8085"
option enabled "true"
Now this was the tricky part, at that point I just imagined how that’s works, but I don't know it for sure. After I had configured and plug in the webcam, I have restarted the router (after some mindblow). And finally I had seen the webcam stream if I looked at this URL with a webbrowser: 192.168.3.1:8085/?action=stream , and for just one picture: /?action=snapshot .
With this we are done, if we reboot the router it will start the streaming at this URL: http://192.168.3.1:8085/?action=stream , where the 192.168.3.1 is the router IP address, 8085 the port just I had configured earlier, and the /?action=stream to start the stream. If you want just one picture you can use /?action=snapshot instead of /?action=stream .
Now the mjpeg_streamer will always start if the router is booted. Here you can see the inits: /etc/init.d/mjpeg-streamer . If you want to start manually you can use this command:
mjpg_streamer -i "input_uvc.so" -o "output_http.so -p 8085"
There is some from the mjpeg-streamer man:
-i | –input ” [parameters]”
-o | –output ” [parameters]”
[-h | –help ]……..: display this help
[-v | –version ]…..: display version information
[-b | –background]…: fork to the background, daemon mode
To open an UVC webcam “/dev/video1” and stream it via HTTP:
mjpg_streamer -i “input_uvc.so -d /dev/video1” -o “output_http.so”
To open an UVC webcam and stream via HTTP port 8090:
mjpg_streamer -i “input_uvc.so” -o “output_http.so -p 8090”
To get help for a certain input plugin:
mjpg_streamer -i “input_uvc.so –help”
In case the modules (=plugins) can not be found:
* Set the default search path for the modules with:
* or put the plugins into the “/lib/” or “/usr/lib” folder,
* or instead of just providing the plugin file name, use a complete
path and filename:
mjpg_streamer -i “/path/to/modules/input_uvc.so”
There are some useful links:
I hope this is helped you at some point. Next time I will try to use my USB storage.