Action Item #535

Retest web cam playback, possibly update it

Added by Hammel over 1 year ago. Updated about 1 year ago.

Status:ClosedStart date:22 Jul 2016
Priority:ImmediateDue date:
Assignee:Hammel% Done:

100%

Category:04 - Applications
Target version:0.11.0
Severity:03 - Medium

Description

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:
  1. Command line args that might improve performance: https://wolfpaulus.com/journal/embedded/raspberrypi_webcam/

Associated revisions

Revision 122917ba
Added by Hammel about 1 year ago

RM #535: Add reuseaddr on messaging socket.

Revision bc4bc486
Added by Hammel about 1 year ago

RM #535: Add -y option to mjpg_streamer command since my only webcams require it.

Revision 97b39aa6
Added by Hammel about 1 year ago

RM #535: Migrate to jpeg-turbo.

Revision d19d933b
Added by Hammel about 1 year ago

RM #535: Modified default dimensions of mjpeg_streamer image to best-result with new webcam on both web UI and console UI.

Revision f242a154
Added by Hammel about 1 year ago

RM #535: Added support for raspicam but keep it commented out because the camera didn't really work.

History

#1 Updated by Hammel over 1 year ago

  • Description updated (diff)

#2 Updated by Hammel about 1 year ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

webcam playback is not working on rpi1 or rpi2. I need to connect the rpi's to the home network so I can view debug output to figure out what's happening.

#3 Updated by Hammel about 1 year 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.

#4 Updated by Hammel about 1 year ago

I had three webcams. One works with both -y and without. Another works only with -y. The third is broke.

For now I'll leave -y in place and work on making the command configurable.

#5 Updated by Hammel about 1 year 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 1 year 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.

#7 Updated by Hammel about 1 year ago

Added support for building either mainline or raspicam port of mjpeg-streamer. Both build into an opkg now. The latter needs to be tested on hardware.

Changes committed and pushed.

#8 Updated by Hammel about 1 year 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.

Lowering priority.

#9 Updated by Hammel about 1 year ago

  • Priority changed from Urgent to Immediate
  • Severity changed from 01 - Critical to 03 - Medium

#10 Updated by Hammel about 1 year ago

I ordered a replacement cable from Adafruit. It was only $2. And yes, it was obviously different than the cable they sent me with the camera.

Should be here this coming friday.

#11 Updated by Hammel about 1 year 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 1 year 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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.

#13 Updated by Hammel about 1 year ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

Updates committed and pushed.

Closing issue.

Also available in: Atom PDF