1

As stated in the title, I'm trying to record 2 USB cameras using Motion. I managed to record video in a single-camera setup; but, when I include the second camera, Motion does not record anything. I applied the procedure explained in the second answer of this question. To be more precise, I used two thread files, thread1.conf and thread2.conf, icludes this code:

# /usr/local/etc/thread1.conf
#
# This config file was generated by motion 3.2.12



###########################################################
# Capture device options
############################################################

# Videodevice to be used for capturing  (default /dev/video0)
# for FreeBSD default is /dev/bktr0
videodevice /dev/video0

# The video input to be used (default: 8)
# Should normally be set to 1 for video/TV cards, and 8 for USB cameras
input 8

# Draw a user defined text on the images using same options as C function strftime(3)
# Default: Not defined = no text
# Text is placed in lower left corner
text_left CAMERA 1

movie_filename %v-%Y%m%d%H%M%S-C1

############################################################
# Target Directories and filenames For Images And Films
# For the options snapshot_, jpeg_, mpeg_ and timelapse_filename
# you can use conversion specifiers
# %Y = year, %m = month, %d = date,
# %H = hour, %M = minute, %S = second,
# %v = event, %q = frame number, %t = thread (camera) number,
# %D = changed pixels, %N = noise level,
# %i and %J = width and height of motion area,
# %K and %L = X and Y coordinates of motion center
# %C = value defined by text_event
# Quotation marks round string are allowed.
############################################################

# Target base directory for pictures and films
# Recommended to use absolute patch. (Default: current working directory)
target_dir /home/pi/motion_vid

############################################################
# Live Webcam Server
############################################################

# The mini-http server listens to this port for requests (default: 0 = disabled)
webcam_port 8081

# Command to be executed when a picture (.ppm|.jpg) is saved (default: none)
# The filename of the picture is appended as an argument for the command.
on_picture_save /usr/local/motion-extras/camparse1.pl

# Command to be executed when a movie file (.mpg|.avi) is closed. (default: none)
# Filename of movie is appended as an argument for the command.
on_movie_end /usr/local/motion-extras/mpegparse1.pl

For the second camera, I used:

videodevice /dev/video1
text_left CAMERA 1
movie_filename %v-%Y%m%d%H%M%S-C2
webcam_port 8082
on_picture_save /usr/local/motion-extras/camparse2.pl
on_movie_end /usr/local/motion-extras/mpegparse2.pl

I tried connecting the cameras both directly to the RPi and by using a powered USB hub; and I think it's not about the power requirements.

In the main .conf file; I tried decreasing fps to 2 (to descrease the bandwidth consumption) and it didn't work either. I record the videos at 640x480 resolution.

Anyone have a suggestion?

Thanks.

1

Try setting the resolution to 320 x 480. I could only get motion to stream two cameras at that resolution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.