selflessscoundrel
Posts: 3
Joined: Thu Jun 28, 2018 6:53 am

USB Webcam stream to server

Tue Oct 23, 2018 9:59 am

Ok, I'm sure this has been covered before, and there seems to be about 1000 ways to do this from using FFMPEG and FFSERVER to Motion, to what-have-you. So I'm gonna list my assets here, and my goals, and see if I'm insane or not because I need some outside validation before I go deeper into the rabbit hole.

ASSETS:
Raspberry Pi 3 B+
Logitech c920 webcam (USB)
connected to network via WiFi
Stand alone PC to act as a receiver/server to receive the stream
Raspbian loaded onto device (latest "lite" build from downloads, I believe Oct 9 2018 build)

in /etc/modules:
bcm2835-v4l2

Initial setup was using the following:

Run the following commands:

Code: Select all

# v4l2-ctl --set-fmt-video=width=320,height=240,pixelformat="H264" -p 5
# ffserver -f /home/pi/ffserver2.conf
# ffmpeg -f v4l2 -override_ffserver -i /dev/video0 http://localhost:8090/feed1.ffm
ffserver2.conf looks like:

Code: Select all

Port 8090
MaxHTTPConnections 1000
MaxClients 1000
MaxBandwidth 1000

<Feed feed1.ffm>
file /tmp/feed1.ffm
FileMaxSize 200k
ACL allow 127.0.0.1
</Feed>

<Stream test1.mpg>
Feed feed1.ffm
Format mpeg
noaudio
VideoBitRate 64
VideoFrameRate 3
VideoSize 320x240
VideoGopSize 12
</stream>

The above produces a decent video but there is some artifacting and frame skips - not smooth. I was thinking that instead of running ffserver on the Raspberry PI I could just run ffmpeg and direct that output direct to a separate computer running a receiver, but I have hit a wall.

I have found motion and other "video through the browser" options lacking.

Is ffmpeg the right option here? It was installed using apt-get so I don't know if it would be better to try and compile.

danjperron
Posts: 3072
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: USB Webcam stream to server

Tue Oct 23, 2018 4:06 pm

The C-920 is mjpeg compatible. Why not using mjpeg streamer instead ?

You could have decent frame rate at full HD size.


viewtopic.php?f=28&t=109352&p=751735#p751735

selflessscoundrel
Posts: 3
Joined: Thu Jun 28, 2018 6:53 am

Re: USB Webcam stream to server

Thu Oct 25, 2018 11:37 am

Trying MJPG-streamer, I followed the instructions in the linked forum post and was able to get the server running at port 10088. While able to access it via VLC and a web browser, no images from my webcam ever showed up.

selflessscoundrel
Posts: 3
Joined: Thu Jun 28, 2018 6:53 am

Re: USB Webcam stream to server

Thu Oct 25, 2018 2:02 pm

WebRTC via UV4L provided an excellent streaming capability with both video and audio.

https://www.linux-projects.org/uv4l/installation/

Return to “Graphics, sound and multimedia”