OpenWrt Forum Archive

Topic: webcam oddity - Chaos Calmer, r47065

The content of this topic has been archived on 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

On a TP-LINK TL-WR703N mini router, I can easily get a usb camera to work.

opkg update
opkg install usbutils kmod-usb-core kmod-usb2 kmod-video-core kmod-video-uvc
opkg install mjpg-streamer

Connect the camera and start the streamer.
/etc/init.d/mjpg-streamer start

Oddly, kmod-usb2 is lost on reboot each and every time so it needs to be re-installed each time.
I then browse over to the router and voila, video.

When I do the same thing using a gl.inet mt300n router, everything installs but when I head for the usr, the streamer program always dies. No image, no error, nothing.

I'm not sure how to diagnose this so hoping someone here might have some input.

Thanks.

projects wrote:

Oddly, kmod-usb2 is lost on reboot each and every time so it needs to be re-installed each time.

How do you notice that it is lost on reboot, i.e., how do you check it?
Anything useful in the logs after installation of kmod-usb2?

It is only lost on the tp-link.
The first time, I simply ran opkg update and install again and it gets re-installed each time.
Then I used opkg list-installed.

I have not looked at logs, didn't know there was one.
Can you tell me where the log is and what I might be looking for and I'll certainly try it.

All I can find for logs is in /tmp
-rw-r--r--    1 root     root             0 Nov  7 21:34 lastlog
-rw-r--r--    1 root     root             0 Nov  7 21:34 wtmp

Check the output of

logread
df -h
free

(Last edited by tmo26 on 28 Jan 2018, 08:10)

Now, do you want me to do this on the tp-link where kmod-usb2 is lost on each reboot or are you wanting me to do this on the gl.inet which kills the streaming program?

I'll start with the gl.inet first since that's the one I'd like to get running.

The following is with the streaming program running, before I go to the browser url;

# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                   11.6M      1.1M     10.5M  10% /
/dev/root                 2.8M      2.8M         0 100% /rom
tmpfs                    30.0M    112.0K     29.9M   0% /tmp
/dev/mtdblock6           11.6M      1.1M     10.5M  10% /overlay
overlayfs:/overlay       11.6M      1.1M     10.5M  10% /
tmpfs                   512.0K         0    512.0K   0% /dev

# free
                    total         used       free     shared    buffers     cached
Mem:         61360      32884      28476        112       2652       9052
-/+ buffers/cache:      21180      40180
Swap:                 0             0              0

Head for the browser, click on http://192.168.1.72:8080/?action=stream
The blue light on the camera flashes for a second then mjpeg-streamer dies.

# df -h
Shows identical to the first run.

# free
                    total         used          free  shared    buffers     cached
Mem:         61360      24908      36452        112       2652       9052
-/+ buffers/cache:      13204      48156
Swap:                0              0              0

Now, I see this which thanks to you is something valuable I didn't know about, logread

Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: starting application
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: MJPG Streamer Version: svn rev: Unversioned directory
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: Using V4L2 device.: /dev/video0
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: Desired Resolution: 1280 x 720
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: Frames Per Second.: 5
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: Format............: JPEG
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: TV-Norm...........: DEFAULT
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: FPS coerced ......: from 5 to 15
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: Frame period time ......: 200 ms
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: www-folder-path...: /www/webcam/
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: HTTP TCP port.....: 8080
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: username:password.: openwrt:openwrt
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: commands..........: enabled
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: starting input plugin input_uvc.so
Sun Jan 28 16:33:54 2018 user.info MJPG-streamer [25009]: starting output plugin: output_http.so (ID: 00)
Sun Jan 28 16:33:55 2018 user.emerg syslog: 2018-01-28 16:33:55
Sun Jan 28 16:33:56 2018 user.emerg syslog: 2018-01-28 16:33:56
Sun Jan 28 16:33:56 2018 user.info MJPG-streamer [25009]: serving client: 192.168.1.205

There is nothing, at least to me, showing why the streaming program died however.
another oddity is that running logread -f doesn't show all of the above and only shows the serving status, as seen as the last line in the above log.

(Last edited by projects on 28 Jan 2018, 17:59)

Nothing helpful so far in the logs.
What about the device where kmod-usb2 is lost? Anything helpful there?

projects wrote:

another oddity is that running logread -f doesn't show all of the above

And it isn't supposed to. -f doesn't stand for "full", but for "follow", printing out log lines as they arrive.

(Last edited by metai on 28 Jan 2018, 21:13)

Yes, -f as in 'tail -f' for example/

It works perfectly on the tp-link, I don't think I'll catch anything in the log since it is lost on reboot which means so will the log file.

projects wrote:

Yes, -f as in 'tail -f' for example/

Unlike "tail -f", "logread -f" does not print any already existing lines. You can do that using "logread -l <number of lines from the end> -f"

Other than logread, I've not found any other tools that might help to diagnose this problem.
Not sure what to try next. I mainly just want to get a webcam working on the gl.inet.

projects wrote:

opkg update
opkg install usbutils kmod-usb-core kmod-usb2 kmod-video-core kmod-video-uvc
opkg install mjpg-streamer

Post the output of opkg during installation and your opkg.conf.

BTW: TL-WR703N has 4/32MB, while your df and free show significantly higher values. How comes?

Sorry for the confusion, details lost in the posts somewhere smile.

I've been showing you the output of the gl.inet since that is the one I am trying to get working first.
FYI, the packages are already installed on the gl.inet. I could re-install the firmware without the packages if that might help.

# opkg update
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/base/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_base.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/base/Packages.sig.
Signature check passed.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/luci/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_luci.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/luci/Packages.sig.
Signature check passed.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/management/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_management.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/management/Packages.sig.
Signature check passed.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_packages.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/packages/Packages.sig.
Signature check passed.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/routing/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_routing.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/routing/Packages.sig.
Signature check passed.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/telephony/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_telephony.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/telephony/Packages.sig.
Signature check passed.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/oldpackages/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_oldpackages.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/oldpackages/Packages.sig.
Signature check passed.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/node/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_node.
Downloading http://www.gl-inet.com/openwrt/ramips/2.261/packages/node/Packages.sig.
Signature check passed.

# opkg install usbutils kmod-usb-core kmod-usb2 kmod-video-core kmod-video-uvc
Package usbutils (007-1) installed in root is up to date.
Package kmod-usb-core (3.18.27-1) installed in root is up to date.
Package kmod-usb2 (3.18.27-1) installed in root is up to date.
Package kmod-video-core (3.18.27-1) installed in root is up to date.
Package kmod-video-uvc (3.18.27-1) installed in root is up to date.

# opkg install mjpg-streamer
Package mjpg-streamer (r182-7) installed in root is up to date.

# cat opkg.conf
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
option check_signature 1

This is getting a bit confusing, since you have two problems on two different machines.

1) TL-WR703N: kmod-usb2 is lost on reboot
- Post the output of opkg during installation of kmod-usb2 etc. and your opkg.conf
- TL-WR703N has 4/32MB, while your df and free show significantly higher values. How comes?

2) GL-MT300N: mjpg-streamer dies
- logread -f
- execute mjpg-streamer
- Post the output of logread -f, and any output that mjpg-streamer delivers

Tmo26, that's why I suggested we only work on the gl.inet first. The tp-link is not as important to me as finding out why the streaming program is dying on the gl.inet.

In terms of posting the log output, I did in another message above. There is no error or anything, the log simply ends with 'serving client', no errors of any sort after it dies. Here it is again.

When running logread with -f, the only thing it shows is;
Tue Jan 30 01:49:16 2018 user.info MJPG-streamer [820]: serving client: 192.168.1.205

When checking logread after the streaming program starts and ends, it shows the following;

Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: starting application
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: MJPG Streamer Version: svn rev: Unversioned directory
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: Using V4L2 device.: /dev/video0
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: Desired Resolution: 1280 x 720
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: Frames Per Second.: 5
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: Format............: JPEG
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: TV-Norm...........: DEFAULT
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: FPS coerced ......: from 5 to 15
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: Frame period time ......: 200 ms
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: www-folder-path...: /www/webcam/
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: HTTP TCP port.....: 8080
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: username:password.: openwrt:openwrt
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: commands..........: enabled
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: starting input plugin input_uvc.so
Tue Jan 30 01:50:20 2018 user.info MJPG-streamer [2395]: starting output plugin: output_http.so (ID: 00)
Tue Jan 30 01:50:24 2018 user.info MJPG-streamer [2395]: serving client: 192.168.1.205

Nothing else related to mjpg-streamer.

(Last edited by projects on 30 Jan 2018, 02:53)

Is there a way of tracing a program while it is running, so as to try and find out when/why it crashes or ends?

Two more thoughts:
1) What happens if you try 640x480 i/o 1280x720?
2) This looks suspicious:

.info MJPG-streamer [2395]: MJPG Streamer Version: svn rev: Unversioned directory

Have you tried a different mjpg-streamer package, e.g. from OpenWrt directly, i/o the GL one?

What about updating to LEDE 17.1.4 to get the latest fixs and packages?

#tapper, once I have a build that works for everything I need, I tend to try and leave it that way as much as possible so that those routers have the exact same build. If I update one, I end up having to update the rest and since I use them as tiny camera servers, which means remote, it's a PITA smile

I can't recall why I started using the gl.inet repo but I do recall it was because a bunch of things were breaking and gl.inet suggested I use their repo.

@tmo26, that's a good idea. I'll give those things a try.

@tmo26, you were dead on. Removing the gl.inet version and installing the openwrt version works perfectly.
I also changed it back to 1280x720 and changed the frame rate to 25, just to push things a bit and it works perfectly. When I reboot, the camera comes back up as required.

So the question now is... why am I using the gl.inet build? I've no idea anymore, it's been too long since I made the change.

Bit confused about which image builder is the correct one anyhow.
The router is an mt300n, the build should be mt7620 but make info doesn't show the mt300n model and the build fails when using 'PROFILE=GL-MT300N'.

http://archive.openwrt.org/chaos_calmer … ps/mt7620/

(Last edited by projects on 1 Feb 2018, 18:25)

Nice that you got it working again smile

GL-MT300N: which one, v1 or v2?

v1 is MT7620, 17.01.4 support
v2 is MT7628, only snapshot support

-> different imagebuilder for v1 and v2

Yes, thanks very much for the help.

There is nothing on the label for version on this. However, I do recall it is the MT7620 version that I originally used before moving to the glinet repo. I think it might have been because at the time, the repo on openwrt was only available in trunk.

It was definitely mt7620 because I've been using the following repo.
http://www.gl-inet.com/openwrt/ramips/2.261/

and there is a text file describing building for the mt300n router.
http://www.gl-inet.com/openwrt/ramips/imagebuilder.txt

It also describes the GL-MT300N as not V2 which seems to imply that the GL-MT300A is V2.
However, images show a V1 as being white while I have the next version which is yellow.
The white route is ar71xx based while the yellow one is ramips.

The mt7620 repo doesn't seem to support the mt300n router.
http://archive.openwrt.org/chaos_calmer … ps/mt7620/

(Last edited by projects on 2 Feb 2018, 16:27)

tmo26 wrote:

Nice that you got it working again smile

GL-MT300N: which one, v1 or v2?

v1 is MT7620, 17.01.4 support
v2 is MT7628, only snapshot support

-> different imagebuilder for v1 and v2

I'm not familiar with these versions but searching seems to lead to the LEDE project. So,
https://downloads.openwrt.org/releases/ … _64.tar.xz

I thought LEDE was born from OpenWrt but that eventually, they merged again. Talk about confusing.
It seems to boot much faster using the lede build.

Also have;
https://downloads.openwrt.org/releases/ … ps/mt7620/

The lede repo doesn't seem to be very reliable or they are having problems as I am working on this.

(Last edited by projects on 25 Feb 2018, 21:36)

LOL, using lede, now the camera doesn't work at all.
Have to dig into this.

I wish I knew why some things are simply not consistent.

The LEDE build doesn't work for me as it won't run some older stuff I need.
That leaves me having to use the gl-net generator.
Installing the gl-net version of mjpeg-streamer leads to it crashing so I removed it and installed the openwrt version which also crashes.

always a segfault.

# /usr/bin/mjpg_streamer -i "input_uvc.so -d /dev/video0" -o "output_http.so"
MJPG Streamer Version: svn rev: Unversioned directory
i: Using V4L2 device.: /dev/video0
i: Desired Resolution: 640 x 480
i: Frames Per Second.: not limited
i: Format............: JPEG
i: TV-Norm...........: DEFAULT
o: www-folder-path...: disabled
o: HTTP TCP port.....: 8080
o: username:password.: disabled
o: commands..........: enabled

Connect to the port and...
Segmentation fault


I'm kind of at a loss using openwrt for streaming.

(Last edited by projects on 26 Apr 2018, 19:25)

The discussion might have continued from here.