Action Item #535
Retest web cam playback, possibly update it
|Status:||Closed||Start date:||22 Jul 2016|
|Category:||04 - Applications|
|Severity:||03 - Medium|
I need to retest the webcam playback to make sure it's still working.
Then I need to test if an increased frame rate works on the RPI2. If so, and it doesn't work on RPI1, then I'll want to build the code with separate frame rates. This is done (I think) in piboxd:stream.c:spawnStream() with the call to mjpg-streamer. Currently I think this is set to 30FPS, which should be fine.
I should also check on the RPi fork that includes support for the RPi camera: https://github.com/jacksonliam/mjpg-streamer
I'll need a Pi camera to test it.
There is also a little article on streaming over the web with mjpg-streamer that might provide a little extra help in getting good streams and what appears to be mjpg-streamer generated web interface. I might be able to integrate those pages into my own UI.Additional help:
- Command line args that might improve performance: https://wolfpaulus.com/journal/embedded/raspberrypi_webcam/
RM #535: Modified default dimensions of mjpeg_streamer image to best-result with new webcam on both web UI and console UI.
#3 Updated by Hammel about 2 years ago
- % Done changed from 10 to 30
The problem was with the webcam I was using. mjpg-streamer allows the camera to use a -y option for YUV. Using that option got the camera to work.
The fix is to use a config file for the command line. The YUV option can be enabled or disabled with a web UI by editing the file. The same can be said for frame rate and resolution.
For now, just hard code the -y option and see if that works with a couple of cameras.
#5 Updated by Hammel about 2 years ago
- % Done changed from 30 to 50
I've built the rootfs with libjpeg-turbo instead of libjpeg and tested with mjpg_streamer. There doesn't seem to be much difference in performance.
I also tried "streameye" with ffmpeg. Performance was never as good as with mjpeg_streamer generating frames and the browser enlarging them.
So the setup I have now is optimal given an USB webcam. I'll test with a raspicam once it arrives and the forked mjpg_streamer and see if that's any better.
#6 Updated by Hammel about 2 years ago
- % Done changed from 50 to 70
Updates to piboxd allow configuring the webcam command in the config file. With that I was able to optimize the playback for a new camera. However, it only does 2 fps @ 640x480, which is good qualify picture but slow motion. Reduced resolution and higher frame rates are not much better.
Now I'm waiting on a RaspiCamera which I'll try with the modified mjpeg-streamer. I expect better performance from this but who knows.
#8 Updated by Hammel about 2 years ago
- Priority changed from Immediate to Urgent
The camera I ordered came with a bad cable. The cable shown on videos I found shows the silver pins on opposite sides of the cable on either end of the cable. My cable has the pins on the same side on both ends.
Until I get a working cable, this task is on hold.
#11 Updated by Hammel about 2 years ago
The experimental repo for raspi camera works fine with the uvc (usb) camera. I just have to add uvcvideo to /etc/modules.conf to make sure it's always available. I also need the updated piboxd package which supports configurable mjpeg-streamer command so that I can add the -y option for cameras that need it.
#12 Updated by Hammel about 2 years ago
- % Done changed from 70 to 90
I've received the new cable and installed it. I built the new mjpeg-streamer and installed it. I updated my config.txt as required to enable the camera.
It still doesn't work. After a bit of research I can see now reason to want to use this camera unless you were trying to embed a camera in a box with the Pi. I'm not trying to do that. Let's look at the reasons why you won't want this camera vs a USB webcam.
- The cable: It's a ribbon cable that is stiff enough that the weight of the camera module isn't enough to counter the cables desire to flip it out of position. A USB cable is more forgiving and the USB cameras weight generally overrides the stiffness of the cable.
- The connectors: The ribbon cable connector is tricky to plug into the board compared to a USB camera. The same connector has the same problem on the camera board. Worse, the Sunny connector is so loose the camera pops out of it on the lightest touch - and you will touch it because the camera module is just a board. It doesn't have an enclosure by default.
- The setup: You have to enable the camera by changing the bootloader config.txt and rebooting. To turn it on: change and reboot. To disable it: change and reboot. This matters because of the next issue.
- The power requirements: the camera is power hungry, up to 300mA. So you don't want to leave it running (apparenty). Not sure how this compares to a webcam. I do notice that starting the raspicam (even though it doesn't work) causes the rainbow box (upper right in newer firmware) to show up, which says I have a voltage drop below 4.8V (so I've read). That doesn't happen with a USB camera plugged into an external hub. And if disabling it is required to avoid power drain that would be a serious problem since it requires changes to the bootloader config and a reboot. And you need to set aside at least 128M in the GPU.
I never got the camera working so couldn't compare it's quality against a USB web cam. But I did get a USB webcam streaming 30fps on the pi TO the pi using mjpeg-streamer and omxplayer. Works great. Nearly no delay in playback. Slight delay only if you stream to a remote player, and that can be attributed to network lag. Yes, this was an external USB hub with its own power supply. Irrelevant. The ease of setup and use of the web cam considering I already need the external hub (for USB media sticks for PiBox) means I'm better off with the USB webcam.
So I can see no reason to use the Raspicam. At least not for my use case.
Reverting default to usb webcam configuration. I'll leave the bits in place to add the raspicam but I don't intend to use it.