Following on from the previous webcam posts, I decided to see if the Pi has enough grunt to stream 2 webcams at once.
The USB driver for the Pi at the moment isn’t quite up to the task at the moment, but I can get the 2 streaming at low resolutions for hours at a time at the moment.
I am still using the original ffmpeg that I compiled back from the first post.
I modified the ffserver.conf so that it would accept 2 streams of input rather than just one.
The following stanza is duplicated
Like so – I added the number to the end to identify which webcam was which.
Then, the Stream stanzas are also duplicated.
These will be the addresses that are accessed to view the stream.
This is also where the bitrate, framerate and quality settings are defined.
After the ffserver.conf file is modified, ffmpeg will need to be run twice. Once for each webcam.
The command is the same, except for changing the input file at the end.
ffmpeg -loglevel info -r 4 -s 160x120 -f video4linux2 -i /dev/video0 http://localhost/webcam0.ffm
ffmpeg -loglevel info -r 4 -s 160x120 -f video4linux2 -i /dev/video1 http://localhost/webcam1.ffm
Running those 2 commands will then start streaming both webcams into ffserver, which will in turn make the streams accessible via a web browser.