0

I have a uv4l server set up on my raspi which is serving a no-name webcam. It is using the uvc driver. The server built-in web page mostly works. I can stream webrtc from the pi to my laptop browser, however the mjpeg button brings up a broken-image icon.

Most importantly, no urls seem to work directly from the server, such as http://raspberrypi:8080/stream/video.mjpeg.

Using the chrome inspection window on that url I can see a return of 200 but the server then closes the connection. VLC is unable to open the connection either.

This is my uv4l command ...

/usr/bin/uv4l -k --sched-rr --mem-lock --config-file=/etc/uv4l/uv4l-uvc.conf     \
             --driver uvc --driver-config-file=/etc/uv4l/uv4l-uvc.conf       \
             --server-option=--editable-config-file=/etc/uv4l/uv4l-uvc.conf  \
             --device-id=1908:2310 

Any ideas?

mark-hahn
  • 411
  • 4
  • 15

2 Answers2

2

One possible reason is that your UVC-based webcam does not support the MJPEG video format natively so you get a blank page from UV4L. As an alternative to the uv4l-uvc userspace driver, you can tell UV4L to make use of the uvcvideo kernel driver. For example, supposing uvcvideo creates /dev/video0, the commands would be something like:

modprobe uvcvideo
uv4l --external-driver --device-name=video0 --server-option '--port=9000'

However, if uvcvideo does not provide MJPEG either your problem would still remain.

ciccina
  • 21
  • 1
  • The webcam definitely doesn't support mjpeg. Just YUYV 640x480. But then what is being sent out webrtc and where is it coming from? I will try to analyse the webrtc stream and I will try your suggestion to try uvcvideo. – mark-hahn Aug 11 '18 at 03:07
  • webrtc uses vp8 or h264, so there must be an transcoding from yuyv. However, in your question you are asking video.mjpeg, for which no yuyv->mjpeg transcoding exists – ciccina Aug 14 '18 at 09:07
  • h264 would be fine, as long as there is no latency problem. Combined with your suggestion for the external driver I may be in business. I'll give it a try. – mark-hahn Aug 14 '18 at 18:12
0

I have googled extensively and I think I understand what is going on even though I couldn't find any clear explanations. The raspicam driver has a lot of features/options including encoding. The uvc driver does nothing except pass the webcam stream through. The uv4l server does no encoding either.

My webcam has only raw yuyv so I needed a real encoding solution. I've used ffmpeg a lot so I chose it. It can encode using the broadcom h.264 hardware so it is only using 20% of the cpu.

I'm using the ffserver program instead of the uv4l server since I'm only serving http and it is a good match for ffmpeg.

mark-hahn
  • 411
  • 4
  • 15