Videostream
-
Videostream is a simple, lightweight video streamer for USB cameras, integrated Pi cameras and likely others.
I have noticed that some of us (me too) end up wresting with various software in order to successfully setup video streaming. As well some of the software has a large footprint and in some cases ends up consuming excessive amounts of CPU and other system resources.
Videostream addresses many of these issues by attempting a "goldilocks" solution - not too big/small not too complex - "just right".
It is particularly useful when you want to same video feed to be consumed by more than one application. For example you want to use a timelapse recording recording program and at the same time monitor in real time.
Videostream is designed to run continuously and can accept a http command to terminate the program. Typically, you would use a browser but curl or other means can be used.
It runs on Linux and Windows10 and WSL
###Version 1.0.0
Initial Version
###Version 1.1.0
[1] Improved the detection of size and formats
[2] Can now select a preferred format
[3] Improved the fallback to a lower size if the selected size is not available.
[4] If the preferred format is not available an available format will be used.
###Version 2.0.0
[1] Adds support for embedded cameras on the latest Raspberry Pi Release (Bullseye with Libcamera).
[2] Some internal restructuring to improve performance.
[3] Updated documentation
The main capabilities include:
- Automatically scans for available cameras and determines the resolutions it / they support.
- Supports USB cameras (most should work).
- Supports integrated Pi Camera and likely other integrated cameras (e.g. from a laptop).
- Is light in its use of system resources
- Allows camera selection if more than one camera is available.
- Allows video size selections.
- Allows video rotation.
- Allows video format selection
The full instructions for downloading / setup are found here:
https://github.com/stuartofmt/videostream -
Videostream on DWC uses the following (example) settings.
settings:
-
Released Version 1.1.0.
[1] Improved the detection of size and formats
[2] Can now select a preferred format
[3] Improved the fallback to a lower size if the selected size is not available.
[4] If the preferred format is not available an available format will be used.
-
Version 2.0.0
Adds support for embedded cameras on the latest Raspberry Pi Release (Bullseye with Libcamera).
See here for full documentation:
-
-
Hi @stuartofmt
I have a pi cam ribbon connected to my Rpi3b+ Duet3
I've tried following the steps on your wiki but I can't get it working; looks like everything is installed, I just can't get it started
I see you have 2 different starting methods; buster and bullseye.
My pi is running DuetPi; is there any way to make it work?
-
@fractalengineer said in Videostream:
Hi @stuartofmt
I have a pi cam ribbon connected to my Rpi3b+ Duet3
I've tried following the steps on your wiki but I can't get it working; looks like everything is installed, I just can't get it started
I see you have 2 different starting methods; buster and bullseye.
My pi is running DuetPi; is there any way to make it work?
I too run a Pi3B+ with a Pi (ribbon cable) camera. So getting you up and running should be straightforward.
Buster and Bullseye refer to Debian releases. The "standard" pi install likely uses one of these.
There are significant differences to the camera drivers, introduced by RPi, for these versions. Essentially a "new way forward" starting with Bullseye. To confound matters further, there are differences between pre Pi4 and RP4.The first thing to resolve is what OS are you using?
cat /etc/os-release
- Next - what cameras are detected:
v4l2-ctl --list-devices
- What is the output of:
ls /dev/video*
Multiple logical camera's will likely be present.
Once you know the answer to the questions above, then the notes and test programs will make more sense (i.e. which ones to use).
Before we go there, there a couple of simple tests that can be made, once the OS version is understood.
-
@stuartofmt understood!
Thank you for your response; looks like it's running buster indeed
pi@duet3:~ $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs" pi@duet3:~ $ v4l2-ctl --list-devices bcm2835-codec-decode (platform:bcm2835-codec): /dev/video10 /dev/video11 /dev/video12 /dev/video18 bcm2835-isp (platform:bcm2835-isp): /dev/video13 /dev/video14 /dev/video15 /dev/video16 mmal service 16.1 (platform:bcm2835-v4l2-0): /dev/video0 pi@duet3:~ $ ls /dev/video* /dev/video0 /dev/video11 /dev/video13 /dev/video15 /dev/video18 /dev/video10 /dev/video12 /dev/video14 /dev/video16
From there I can confirm opencv seems to be properly installed, as the
cv2.__version__
command does return 3.4.4Next I enabled the camera and performed the camera test; looks like it's on Cam0
pi@duet3:~ $ raspistill -v -o test.jpg "raspistill" Camera App (commit bab9bf8790cd Tainted) Camera Name ov5647 Width 2592, Height 1944, filename test.jpg Using camera 0, sensor mode 0 GPS output Disabled Quality 85, Raw no Thumbnail enabled Yes, width 64, height 48, quality 35 Time delay 5000, Timelapse 0 Link to latest frame enabled no Full resolution preview No Capture method : Single capture Preview Yes, Full screen Yes Preview window 0,0,1024,768 Opacity 255 Sharpness 0, Contrast 0, Brightness 50 Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0 Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none' Flicker Avoid Mode 'off' Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128 Rotation 0, hflip No, vflip No ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000 Camera component done Encoder component done Starting component connection stage Connecting camera preview port to video render. Connecting camera stills port to encoder input port Opening output file test.jpg Enabling encoder output port Starting capture -1 Finished capture -1 Closing down Close down completed, all components disconnected, disabled and destroyed
Following this I tried launching the stream again with
python3 ./videostream.py -camera0 -port 8082 -rotate 180 -size 5 2>/dev/null
But the stream link remains empty.
I then went back to my install directory to check for videostream installation and got this
pi@duet3:~/videostream $ python3 ./videostream.py -h Traceback (most recent call last): File "./videostream.py", line 10, in <module> import imutils ModuleNotFoundError: No module named 'imutils'
So I reinstalled again, attempted to start it again and I'm getting the imutils message again
pi@duet3:~/videostream $ Traceback (most recent call last): File "./videostream.py", line 10, in <module> import imutils ModuleNotFoundError: No module named 'imutils'
I then tried using the apt-get command to fetch imutils but it won't find it.
Any tips from there? Thanks!
-
@fractalengineer try
pip3 install imutils
-
@jay_s_uk holy it's working! brilliant thank you, I've had this cam wired for the past 2years and couldn't get it to work haha
So do I need to go in putty and start the service every time I reboot? Or is there a way to have it autostart
-
@fractalengineer said in Videostream:
@jay_s_uk holy it's working! brilliant thank you, I've had this cam wired for the past 2years and couldn't get it to work haha
So do I need to go in putty and start the service every time I reboot? Or is there a way to have it autostart
I set mine up to autostart using systemctl.
There are instructions here:
https://github.com/stuartofmt/videostream/blob/master/system-unit-file.md
and a sample unit file here:
https://github.com/stuartofmt/videostream/blob/master/videostream.service
-
@stuartofmt Thank you!
Just wanted to post an update to say I got it working and it's running just fine; great work!
-
-
-
-
-