0

I'm using Motion on an rPi 4B as a multi camera solution to be used on a boat (to get 180° front view). I tested it with 2 IP camera's and one USB camera and that worked fine. I was able to view the live streams of these 3 cameras side by side on a HTML page.

However, the cameras I need to use on the boat are composite video cameras. They are simple car backup cameras as can be found on eBay and AliExpress. To get them to work on the rPi, I bought a generic "EasyCap 4 channel USB Video Capture Device". It has 4 composite video inputs and 1 audio input. It is recognized by Raspbian as the STK1160 (which is correct).

One of the two CV cameras is connected to input 1 of the capture device, the other to input 2. Each camera has its own config file:

Camera 1:

# /etc/motion/conf.d/camera1.conf
#
text_left This is camera 1
videodevice /dev/video0
input 0
norm 1
stream_port 8083

Camera 2:

# /etc/motion/conf.d/camera2.conf
#
text_left This is camera 2
videodevice /dev/video0
input 1
norm 1
stream_port 8084

The only difference between the two config files being the input channel and the streaming port.

Problem is, when both config files are enabled, neither work. Instead of two live streams, I see two broken image icons on the HTML page. If I enable just one of the two, regardless of which one, I can see that camera's stream.

Here is the motion log with both config files enabled:

[29750920:motion] [NTC] [ALL] [Jul 26 11:07:27] motion_startup: Using log type (ALL) log level (NTC)
[29750920:motion] [NTC] [ALL] [Jul 26 11:07:27] become_daemon: Motion going to daemon mode
[29750920:motion] [NTC] [ALL] [Jul 26 11:07:27] become_daemon: Created process id file /var/run/motion/motion.pid. Process ID is 644
[29750920:motion] [NTC] [ALL] [Jul 26 11:07:27] motion_startup: Motion running as daemon process
[29750920:motion] [NTC] [ENC] [Jul 26 11:07:27] ffmpeg_global_init: ffmpeg libavcodec version 58.35.100 libavformat version 58.20.10
0
[0:motion] [NTC] [ALL] [Jul 26 11:07:28] main: Camera ID: 1 is from /etc/motion/cameras.d/camera2.conf
[0:motion] [NTC] [ALL] [Jul 26 11:07:28] main: Camera ID: 1 Camera Name: (null) Device: /dev/video0
[0:motion] [NTC] [ALL] [Jul 26 11:07:28] main: Camera ID: 2 is from /etc/motion/cameras.d/camera1.conf
[0:motion] [NTC] [ALL] [Jul 26 11:07:28] main: Camera ID: 2 Camera Name: (null) Device: /dev/video0
[1:ml1] [NTC] [ALL] [Jul 26 11:07:28] motion_init: Camera 1 started: motion detection Disabled
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] vid_start: Opening V4L2 device
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_start: Using videodevice /dev/video0 and input 1
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_get_capability:
------------------------
cap.driver: "stk1160"
cap.card: "stk1160"
cap.bus_info: "usb-0000:01:00.0-1.4"
cap.capabilities=0x85200001
------------------------
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_get_capability: - VIDEO_CAPTURE
[2:ml2] [NTC] [ALL] [Jul 26 11:07:28] motion_init: Camera 2 started: motion detection Disabled
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_get_capability: - READWRITE
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_get_capability: - STREAMING
[2:ml2] [NTC] [VID] [Jul 26 11:07:28] vid_start: Opening V4L2 device
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_select_input: name = "Composite1", type 0x00000002, status 00000000
[0:motion] [NTC] [ALL] [Jul 26 11:07:28] main: Waiting for threads to finish, pid: 644
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_select_input: - CAMERA
[0:wc0] [NTC] [STR] [Jul 26 11:07:28] http_bindsock: listening on any IPv4 address port 8080
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_select_input: - video standard NTSC
[0:wc0] [NTC] [STR] [Jul 26 11:07:28] httpd_run: Started motion-httpd server on port 8080 (auth Disabled)
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_select_input: - video standard NTSC-M
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_select_input: Set standard method 45056
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_set_pix_format: Configuration palette index 17 (YU12) doesn't work.
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_set_pix_format: Supported palettes:
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_set_pix_format: (0) UYVY (UYVY 4:2:2)
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_set_pix_format: 0 - UYVY 4:2:2 (compressed : 0) (0x59565955)
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_do_set_pix_format: Testing palette UYVY (1280x720)
[1:ml1] [WRN] [VID] [Jul 26 11:07:28] v4l2_do_set_pix_format: Adjusting resolution from 1280x720 to 720x480.
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_do_set_pix_format: Using palette UYVY (720x480) bytesperlines 1440 sizeimage 691200 colorspace 00000001
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_set_pix_format: Selected palette UYVY
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_scan_controls: found control 0x00980900, "Brightness", range 0,255
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_scan_controls:       "Brightness", default 128, current 128
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_scan_controls: found control 0x00980901, "Contrast", range 0,127
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_scan_controls:       "Contrast", default 64, current 64
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_scan_controls: found control 0x00980902, "Saturation", range 0,127
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_scan_controls:       "Saturation", default 64, current 64
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_scan_controls: found control 0x00980903, "Hue", range -128,127
[1:ml1] [NTC] [VID] [Jul 26 11:07:28] v4l2_scan_controls:       "Hue", default 0, current 0
[1:ml1] [NTC] [ALL] [Jul 26 11:07:28] image_ring_resize: Resizing pre_capture buffer to 1 items
[2:ml2] [NTC] [ALL] [Jul 26 11:07:28] image_ring_resize: Resizing pre_capture buffer to 1 items
[2:ml2] [NTC] [VID] [Jul 26 11:07:28] v4l2_select_input: name = "Composite0", type 0x00000002, status 00000000
[2:ml2] [NTC] [VID] [Jul 26 11:07:28] v4l2_select_input: - CAMERA
[2:ml2] [NTC] [VID] [Jul 26 11:07:28] v4l2_select_input: - video standard NTSC
[2:ml2] [NTC] [VID] [Jul 26 11:07:28] v4l2_select_input: - video standard NTSC-M
[2:ml2] [NTC] [VID] [Jul 26 11:07:28] v4l2_select_input: - video standard NTSC-M-JP
[2:ml2] [NTC] [VID] [Jul 26 11:07:28] v4l2_select_input: - video standard NTSC-M-KR
[2:ml2] [NTC] [VID] [Jul 26 11:07:28] v4l2_select_input: Set standard method 45056
[2:ml2] [NTC] [VID] [Jul 26 11:07:28] v4l2_set_input: set_input_skip_frame switch_time=1627290448.273007
[1:ml1] [NTC] [STR] [Jul 26 11:07:28] http_bindsock: listening on any IPv4 address port 8084
[1:ml1] [NTC] [ALL] [Jul 26 11:07:28] motion_init: Started motion-stream server on port 8084 (auth Disabled)

(It's a bit confusing camera1.conf gets camera ID 2, and camera2.conf gets camera ID 1 but that can be easily fixed by setting the ID in the config files).

So what's going on here?

Your Answer

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

Browse other questions tagged or ask your own question.