How to use v4l (Video 4 Linux) with multiple IP Cameras

For whatever reason my initial install of Tumbleweed didn’t have /dev/video* so I played around until it did which I think installing HandBrake created it but I wouldn’t swear by it.

In any case through this process I learned of V4L and now I am wondering if I have a correct setup. I have a few cameras around the house (5 at the moment), mostly to learn about surveillance camera software so I installed “motion” on this Linux box and it has a default of picking up cameras from /dev/video0.

This seems to work but given that I have all sorts of different cameras so different frame rates, resolutions and so on coming into the computer from cameras on their own IP addresses on my LAN I wonder if I should be setting each camera up on its own device so: /dev/video0, /dev/video1, … or if it’s normal and fine for them all to be coming in on this one /dev/video0 which just happens to be there but was never setup for this usage.

Does anyone have a experience with Video4Linux (V4L) in terms of how you should use it? As you can tell I am completely new on this subject.

Thanks,
Reg

The IP cameras typically use the RTSP protocol (or sometimes HTTP protocol) for streaming. Only V4L2 devices (eg webcams) will be associated with the /dev/video* device nodes.

Some helpful references:
https://motion-project.github.io/motion_config.html
https://wiki.gentoo.org/wiki/Motion
https://forums.raspberrypi.com/viewtopic.php?t=324883

@Reg_gie Log into the camera and set up the main and sub stream to what resolution frame rate etc your wanting (suggest also h264 encoding).

Some cameras indicate in the settings what it should be, but something like the following should work;

rtsp://user:pass@ipaddress:[RTSP PORT]/media/video[STREAM TYPE]
or
rtsp://user:pass@ipaddress:[RTSP PORT]/Streaming/Channels/[STREAM TYPE]

Port is normally 554, but again this can be configured on the camera, Stream type will either be 0 for the main stream and 1 for the substream.

Thanks @malcolmlewis. Yeah, I have the cameras showing up so that’s good. I found this software “ONVIF Device Manager” (it’s Windows but hopefully I’ll find a Linux equivalent at some point) which gives me the URLs for each camera output so that makes it easy.

Getting the cameras to streams into the box isn’t really the issue although I do have a couple of issues.

One camera that it doesn’t like the video feed from but the “ONVIF Device Manager” picks up the video just fine. I can’t find anything on the logs from motion to show what’s wrong and protocol is just h264 which I stream from other cameras just fine. That one’s a mystery at the moment.

The other is that I have a camera I can set to h265 and I have installed anything in the way of a codec that I could find on Tumbleweed that’s h265 yet it has issues with it. Fortunately I can just set that camera to h264 and it all works but it would be nice to have it working with the newer protocol.

Ah, then I can ignore /dev/video* then for this purpose. Thanks.

hi
If you only want to monitor and record sometime, create an .m3u file with the urls of your cameras to open it with VideoLan.

vlc --network-caching=0 --clock-synchro=0 CAM-URL
or
vlc -L --playlist-autostart --network-caching=0 --clock-synchro=0 FILE.M3U

I actually want to use motion. It’s cool software and only records when motion is detected if you set it up that way and is designed for multiple cameras. However, having other software on my Linux machine to see if I can get video to at least show allows me to see if issues are with motion or my machine not coping so there is value for sure. I’ve used vlc for testing a URL, I have never used it to record, that’s a neat trick.