atux_null
Posts: 126
Joined: Thu Jun 21, 2012 1:58 pm

rpi cam with motion & usb cameras

Fri Jan 11, 2019 2:10 pm

i do have a RPI with rpi cam and by using the software motion it can motion(dah) detect movement. It records it as video and still images. Also it provides in http://IP_ADDRESS:8081 a stream.

I would like to add another one or two usb cameras (Microsoft lifecam HD 3000) and motion detect from all three cameras, as well present in a single webpage the stream of each camera in a tile.

Has anyone got any ideas on how to create it, please?

Andyroo
Posts: 795
Joined: Sat Jun 16, 2018 12:49 am

Re: rpi cam with motion & usb cameras

Fri Jan 11, 2019 3:34 pm

There are some basic instructions here https://www.techradar.com/how-to/comput ... ra-1321441 but it has pop ups and auto run videos on the pages that I can not stop.

They are safe for work but it bugs me to send folk there!
Need Pi spray - these things are breeding in my house...

atux_null
Posts: 126
Joined: Thu Jun 21, 2012 1:58 pm

Re: rpi cam with motion & usb cameras

Fri Jan 11, 2019 5:18 pm

Hi. That link has only details for one camera ( the onboard). Apart from the onboard, i would like to use an extra or two usb cameras.

chadk5utc
Posts: 7
Joined: Wed Dec 26, 2018 4:34 pm

Re: rpi cam with motion & usb cameras

Sun Jan 13, 2019 9:42 pm

I think this is the best how to Ive seen for this. I have one setup with several cameras. PLus it can be configured to monitor 2 doors

https://www.raspberrypi-spy.co.uk/2017/ ... tioneyeos/

atux_null
Posts: 126
Joined: Thu Jun 21, 2012 1:58 pm

Re: rpi cam with motion & usb cameras

Mon Jan 14, 2019 12:51 pm

Thanks a lot for the reply, but i will not go to MotionEyeOS for this project.
Currently the system has the rpi cam on /dev/video0 and it is working with motion.conf to get snapshots and see it in the browser (http://IP:8081).
The usb camera (microsoft lifecam HD3000) is on /dev/video1 and it can take videos and photos by making use of the fswebcam.
I would like to be able to see the usb cam 's video in a browser as well get motion detection in motion.conf


Anyone please?

atux_null
Posts: 126
Joined: Thu Jun 21, 2012 1:58 pm

Re: rpi cam with motion & usb cameras

Tue Jan 15, 2019 9:54 am

i failed to see the second camera. I have motion working working with the onboard camera and i added a usb camera (Microsoft lifecam HD3000) and it is recongised from the system since i can manually see with the software fswebcam.
/dev/video0 is the onboard camera
/dev/video1 is the usb camera i have two files (Camera 1 and camera 2). Motion.conf:
daemon on
process_id_file /var/run/motion/motion.pid
setup_mode off
logfile /var/log/motion/motion.log
log_level 6
log_type all
v4l2_palette 17
input -1
norm 0
frequency 0
power_line_frequency -1
rotate 0
width 1280
height 960
framerate 80
minimum_frame_time 0
netcam_keepalive off
netcam_tolerant_check off
rtsp_uses_tcp on
auto_brightness off
brightness 0
contrast 0
saturation 0
hue 0
roundrobin_frames 1
roundrobin_skip 1
switchfilter off
threshold 1500
threshold_tune off
noise_level 32
noise_tune on
despeckle_filter EedDl
smart_mask_speed 0
lightswitch 0
minimum_motion_frames 1
pre_capture 5
post_capture 5
event_gap 60
max_movie_time 0
emulate_motion off
output_pictures on
output_debug_pictures off
quality 75
picture_type jpeg
ffmpeg_output_movies off
ffmpeg_output_debug_movies off
ffmpeg_timelapse 0
ffmpeg_timelapse_mode daily
ffmpeg_bps 400000
ffmpeg_variable_bitrate 0
ffmpeg_video_codec mpeg4
ffmpeg_duplicate_frames true
use_extpipe off
snapshot_interval 0
locate_motion_mode off
locate_motion_style box
text_right %d-%m-%Y\n%T-%q
text_left rpi0w_CAMERA %t
text_changes off
text_event %Y%m%d%H%M%S
text_double off
target_dir /home/pi/camera_images
snapshot_filename %v-%Y%m%d%H%M%S-snapshot
picture_filename %Y_%m_%d/%v-%d%m%Y_%H%M%S-%q
movie_filename %Y_%m_%d/%v-%d%m%Y%_H%M%S-%q
timelapse_filename %d%m%Y-timelapse
ipv6_enabled off
stream_port 8081
stream_quality 50
stream_motion off
stream_maxrate 1
stream_localhost off
stream_limit 50
stream_auth_method 0
webcontrol_port 8080
webcontrol_localhost off
webcontrol_html_output on
track_type 0
track_auto off
track_iomojo_id 0
track_step_angle_x 10
track_step_angle_y 10
track_move_wait 10
track_speed 255
track_stepsize 40
quiet on
camera /etc/motion/camera1-dist.conf
camera /etc/motion/camera2-dist.conf
#################################################
camera1-dist.conf


camera_id = 1
videodevice /dev/video0
input -1
text_left CAMERA 1
picture_filename CAM1_%v-%Y%m%d%H%M%S-%q
stream_port 8081


#################################################
camera2-dist.conf


camera_id = 2
videodevice /dev/video1
input 1
text_left CAMERA 2
picture_filename CAM2_%v-%Y%m%d%H%M%S-%q
stream_port 8082



###################################################
if i go to http://IP:8080 i see twice the onboard camera and the usb it says unable to open camera

https://ibb.co/nfgNyPB





ANy ideas please

pfletch101
Posts: 299
Joined: Sat Feb 24, 2018 4:09 am

Re: rpi cam with motion & usb cameras

Tue Jan 15, 2019 10:03 pm

I have been struggling with this, too, and you are not making one of the mistakes that was causing me problems (it was not clear from the guides that I have read that each camera needs a different stream_port). However, when the dual setup was still not working after I corrected that, (to simplify things) I set up the USB webcam on its own under motion on a separate Pi, I found that it didn't work there, either! I happen to have two spare webcams; I was using the older of the two (a Logitech C310) for my Pi experiments, and it occurred to me to try the newer one (a Logitech QuickCam Fusion), instead. Rather to my surprise, the newer camera worked as it should in the solo setup, and I have been able to confirm that it works in the dual-camera setup, too.

Both cameras were correctly identified by lsusb, and both work when used directly as pygame cameras, but the older one appears to have some incompatibility with motion. I wonder if you are experiencing a similar problem.

atux_null
Posts: 126
Joined: Thu Jun 21, 2012 1:58 pm

Re: rpi cam with motion & usb cameras

Wed Jan 16, 2019 7:37 am

thanks a lot for the reply. i have a motion.conf and 2 files one for each camera, as it is stated in the motion documentation. In each camera file i have a different stream_port. the issue is that i get on 8081 the first camera (onboard) to work fine and on 8082 the second camera to state unable to open camera.
It is definitely a config issue since this camera works in an identical raspberry with motion and it works as charm
the other issue that i have noticed is how many cameras i see in the webcontrol page 8080. Once i have only one camera (either onboard or usb) it's only the motion.conf and i see only one camera in the webcontrol page. Once i add the second camera, according to the documentation i have to add one camera1.conf file with the settings for the first camera and another file camera2.conf with the settings of the second camera. In this case in the webcontrol i see 3 cameras. the first two are identical and it is the first camera and then a 3rd camera which is the non-displaying camera.

pfletch101
Posts: 299
Joined: Sat Feb 24, 2018 4:09 am

Re: rpi cam with motion & usb cameras

Wed Jan 16, 2019 1:57 pm

I don't have much to add, except that I, too, in the working 2-camera setup, see 3 cameras reported on the config page, but only two streaming images are displayed on that page. It almost seems as if it is counting config files rather than the actual cameras.

Return to “Automation, sensing and robotics”