RTSP, OBS and lenses

Dear Lazyweb,

The SDI cameras we use for the DNA Lounge webcast are flaky. I think we spent about $200 each on years ago, and they lose their minds with ~100' cable lengths, even though that is well within spec. We've also burned money on repeaters that don't help.

It has come to my attention that IP cameras have plummeted in price: they're like $25 now. So if I can replace all of my cameras with something better for like $400 all in, sure, I'd do that.

Questions:

  1. If I configure OBS with 16 RTSP-camera input sources, and only one of them is being displayed at a time, is OBS holding open a TCP connection and ingesting video from one camera or from sixteen cameras?

    Because one HD stream my network can handle. Sixteen, not so much. And if I have to do a cat6 homerun for each camera, then the labor cost makes this project too expensive to contemplate.

  2. If OBS does do what I want and re-open the stream to the camera when it is selected, how does it deal with the fact that the "rtsp play" command probably is not sensible enough to always start off with an i-frame?

  3. Most security cameras come with 2.8mm lenses, which is far too wide for our purposes. 1.2mm is much better. These specs are incredibly difficult to search for. Can you find me a ~$25 RTSP IP camera that has a 1.2mm lens?

    If I put in literally any search terms at all beyond "rtsp", I don't get better results but the price jumps from $25 to $100+.

Previously, previously, previously.

Tags: , , , ,

32 Responses:

  1. eerie quark doll says:

    If 2.8mm is too wide, 1.2mm would be even wider - are you asking to find a 12mm?

  2. SCOTT TURNER says:

    It looks like zoomable RTSP typically go 2.8 to 12mm, so that might work for you.

    It looks like HikVision makes some 12mm fixed cameras, but I couldn't easily find a place to actually buy them, so no idea on the price.

  3. Logan Bowers says:

    I've installed about 50 different IP cameras across my two shops. All were wired ethernet and required by regulation. Some random thoughts that will likely apply to your situation:

    If you think iTunes is bad, wait until you maintain systems with consumer-grade camera firmware. I've tried D-Link, Linksys, TrendNET, Dahua, and a few other brands of camera. D-Link in particular suffers from memory corruption and crashes. Dahua has been the most reliable, but has the worst configuration tooling (proprietary Windows app, IIRC). TrendNET has been the best balance over 4 years. My general take is be prepared to pay with time with cheap/bad cameras.

    If your existing cameras are analog on coax, you can use ethernet extenders to get Fast Ethernet over coax (Planet's VC-232g or consumer-level MoCA adapters).

    • jwz says:

      If your existing cameras are analog on coax, you can use ethernet extenders to get Fast Ethernet over coax (Planet's VC-232g or consumer-level MoCA adapters).

      Yes, and one encoder/decoder pair per camera ends up costing an additional $150+ each, plus I'm again back to needing to do a whole new set of cat6 runs, which costs more than the cameras do.

      • ssl-3 says:

        For coax - Ethernet bridges on the cheap, don't use MOCA.

        DirecTV's very similar DECA devices are plug and play, zero-config dumb devices that just work. I've been buying them new for a few dollars a piece, shipped Prime. (As far as I can tell, they fall off the backs of DirecTV trucks by the thousands.)

        It's the same protocol as MOCA, just in a different slice of spectrum, and at 1/20th the price. It will not be struggling at the cable lengths you mention. You can use them one-to-one or many-to-many as bandwidth needs dictate.

        For cameras, perhaps a better search term is Onvif. Onvif is an a compatibility standard for IP cameras and is well-established. All Onvif cameras alsl support RTSP.

        • ssl-3 says:

          Also, look before you leap.

          A lot of these cameras (expensive and not) fall down in various ways in low-light situations that might be undesirable for your presumed goal of having a smooth-looking web stream.

          Things like dramatically increased exposure, fractional framerates, dropping to B&W mode (which can be fake or involve removing the color filter from the sensor automatically) and irrevocably using IR LEDs to "see" in the dark.

          And sometimes they do this in ways that make a 1990s Hi8 camcorder look awesome by comparison.

          Please make sure that you are OK with this, or that whatever model you pick can be fucked into not doing this, before you jump into a nightclub full of these.

      • Logan Bowers says:

        Do you have any quality standards for this use case? I have to imagine relative to an SDI camera, a cheap CMOS-security camera is going to look like absolute garbage.

  4. Christian says:

    I'll volunteer some time to help run cable if you'd like. Paying a cabler will be pricey, but a handful of volunteers shouldn't take a horribly large amount of time.

  5. Pedro says:

    > Because one HD stream my network can handle. Sixteen, not so much.

    Are you sure? H264 encoded video is very light on bandwidth. If by HD you mean 1080p I would expect you could have all 16 cameras on a single 100Mbps link.

    • James Baicoianu says:

      +1 to this. 1080p 30fps h264 should be somewhere in the 8mbit range. It might push a 100mbit network a bit too hard, but a gigabit network should handle it with ease.

      • jwz says:

        Many nights I have 500 bags of water all pointing their phones at the stage and trying to stream over our wifi, while our bar iPads are also hoping to be able to process credit cards. I assure you, there is a vast chasm between "it should be fine" and "it actually is fine".

        • James Baicoianu says:

          They're saturating your dsl upstream well before your internal network starts to sweat, unless something else is horribly wrong. Like if you're still running on 100mbit hubs, or something equally not-all-that-unlikely :D

          • jwz says:

            Sorry dude, once you're on site at 1am trying to figure out what piece went sideways this time, that's when you get to "well actually" me.

  6. pnuk says:

    RTSP just does the signalling over TCP to set up the video stream over RTP/UDP.

    Without a test rig available to me at the moment, I’m not certain how OBS handles the scenario you described. But reasoning it through, it’s either: too much data for your network (as you suggest), or significant viewer latency as one RTSP session is torn down and a second established each time the inputs are switched.

    FWIW other protocols worth investigating is “NDI”. This is broadcast contribution tech and more aligned with your needs than cheap CCTV cams. It will almost certainly be outside the range of “$25/camera”.

    Normally, SDI is by far the better option. Out of curiosity, what sort of kit are you using: camera, video switcher, signal repeater, etc? I ask because that $400 might be just about right to upgrade to a used Blackmagjc
    Video Hub or something similar that’s better, should that be the problem and not the cameras themselves.

    • jwz says:

      Currently: HD SDI cams -> Blackmagic Videohub 20x20 switcher -> Roland VC-1DL frame sync -> Blackmagic UltraStudio MiniRecorder -> Mac Mini -> OBS.

      • I will be surprised if you find prosumer-grade security cameras that need equal or less babysitting. I will also be surprised if you find anything at a reasonable cost that looks better than the HD SDI cameras. And I _am_ surprised that the WiFi traffic is on any network you care about.

        • jwz says:

          I was hoping less for "looks better than" and more for "actually works".

          Your vague armchair quarterbacking of my network architecture will be considered once it includes an offer to pay for whatever additional hardware it is that you are surprised that I don't already own.

      • pnuk says:

        In these situation I look to eliminate as many “magic, black boxes” as possible.

        It could well be the videohub breaking things. I’ve seen these degrade and break in non-obvious ways , like introducing color shifts or latency. They don’t call them BlackMagic for nothing.

        Is the MiniRecorder HDMI or SDI in? If the latter, does it work if you connect the camera directly to the ultrastudio, leaving out the Roland box and VideoHub? Keeping HDMI out of the picture is recommended.

  7. Lee says:

    I've been very happy with my UniFi IP cameras. The G3 Pro has a zoomable lens from 3-9mm, and they're a few hundred bucks. Less if you can find them used. They are very easy to set up for a local (read: non-Clown) deployment, and they have RTSP URL support so I presume you can plug them in to any system that takes those (although for my purposes, the proprietary UniFi system has been great so far).

    • Eric Hodel says:

      16 * $250 for the cheapest version with a 3–9mm zoom, 200W POE switch to power them all, CloudKey Gen2+ for configuration and you're at $5,362.

      An order of magnitude above the desired price range.

      • Lee says:

        Oh jeez, mea culpa. I skimmed the original article and thought he only wanted one or two.

        FWIW, one doesn't _need_ the Cloud Key or the PoE switch - they come with an inline PoE dongle, and are able to be configured via an app. The extra hardware IS nice, but not necessary, if one is looking to do it on the cheap(er).

  8. Terry says:

    RTSP cameras ( as the umbrella term ) is a landmine filled wasteland of partial implementations and inscrutable documentation.

    I evaluated several IP cameras and settled on the least worst. My permanently recording setup uses Dericams.

    Overall, only buy one at a time... quickly evaluate it in all the desired locations. Return if not good enough. Buy a different brand. Repeat until satisfied.

    Even with the Dericams I was forced to open up the camera and wrap tin foil around the microphone cable because the cable was picking up wifi antenna interference like oldschool mobile phones.

    As regards to the software that reads / repeats the images. It is all a hodge podge and quite difficult to get to work reliably. If you know OBS to work, that's great.

    I don't have access to run Ethernet so I am forced to 'rely' on Wifi. Avoid this if at all possible.

    To achieve the hands-off recording, i was forced to use FFMPeg. I was
    UDP transport regularly leads to corrupt images ( wifi tho ). TCP connections often freeze FFMpeg, requiring a reaper process to kill of halted ffmpeg process.

    Other more specific RTSP software (openRTSP) has its own share of bugs / missing features / inscrutable documentation. I had to go back to ffmpeg.

  9. Commandhat says:

    If I configure OBS with 16 RTSP-camera input sources, and only one of them is being displayed at a time, is OBS holding open a TCP connection and ingesting video from one camera or from sixteen cameras?

    Yes and no, at the same time.

    OBS does this weird thing where it holds open a TCP connection for every active source -- even if it's not on screen, even if you deselect the checkbox so the source is not active. So if you just lazily import all sixteen sources at the same time into one scene, then it will try and hold all 16 connections.

    however, OBS's connections are per-scene. So if you create 16 scenes and use one source per scene, then you'll only see one TCP connection at a time -- maybe two, if you decide to use the fancy blur transitions or whatever.

    This also means if your network can handle two or four connections from OBS at the same time, you could create scenes with multiple cameras and OBS will hold all four TCP connections.

    If OBS does do what I want and re-open the stream to the camera when it is selected, how does it deal with the fact that the "rtsp play" command probably is not sensible enough to always start off with an i-frame?

    I never actually dealt with raw video streams and I'm not even sure which wild west implementation of rtsp OBS uses. I know it can take a standard web browser input and render it at 60FPS (30 is the default, you can edit some settings to get it up to 60), so you might look into running a local web server, having OBS connect to that, then having the webserver handle the hard work of embedding the RTSP bullcrap in an iframe.

    That being said, if you're running a web server just to handle RTSP connections you might as well not use OBS in the first place.

  10. cowmix says:

    So RasPi with USB cameras (or the dedicated camera) is not an option here?

    • jwz says:

      I'm looking for a $15 camera and you just suggested a $65 camera kit. $80 if you want an enclosure instead of a bare board. $95 if you want to actually be able to power it. Oh, you want a mount that you can attach to a wall so you can point in some particular direction, too? Now we're up to $130.

      • It's not quite that bad. Call it $25 for board, power supply, and enclosure, another $25 for a better camera module, and another $8 for an SD card. We're up to about $60.

        But your point still holds, and while I think twenty-year-ago Jamie would have enjoyed toying with the Pi, current Jamie has got better things to do than to fuck with the hell that is configuring an OS that thinks it knows better than you, on a piece of hardware that is trying desperately to turn the SD card into slag.

        I mean, I don't think a Pi solution would be your worst option. It just isn't the savior that some would think.

        • jwz says:

          I've done a bunch of stuff with Pis, they're fine. It's just a ridiculously overpriced, overpowered and over-complicated solution when what you want is "a cheap camera".

          But if all you have is a hammer everything looks like a thumb, I guess.

          (And that enclosure doesn't have any kind of ball-and-socket mount on it, so you can point the camera in any direction you want as long as that is 90° perpendicular.)

          • Actually, I take it all back, anyway: The Zero-W is WiFi only, and isn't going to work at all. If you did switch to one that is wired, then you'd have the ridiculous problem of having cables coming out in four different directions along with the expense.

            I love and hate this timeline. Everything's so amazing, but everything's such crap.

  11. whoneyc says:

    I am tackling a similar problem for my work, and I might have some insight. With an alternative approach. I have two approaches I've played with.

    1. USB 3.0 camera modules. This is a nice straightforward, wired approach. The USB 3.0 bandwidth is fat enough for HD streams. Your magic search terms are "USB3 ELP Camera Module". I pulled mine from amazon for <$50/ea. Honestly, this is my preferred solution because it keeps things nice and simple without dealing with the internet streams. All you need to do is unpack the video stream with some light code.

    2. Cheap Chinese "action cam" type cameras. These are insecure devices that can stream over wifi. They want you to use their shitty phone apps to operate them, but Jonas Koeritz (https://blog.jonaskoeritz.de/2019/09/11/revisiting-cheap-action-cams/) has hacked them to be used with an RTSP stream. One stream = one socket, but you can set the socket to something custom in his code. Jonas responds to emails and issues on github if you want to ask him about his stuff.

    Both of these options use the same type of cheap lens in a standard socket. Depending on what kind of sensor you get, you will want a different focal length to get your desired f stop, so I cannot recommend what is perfect for you. e.g. since I am using an old series Sony IMX sensor on the USB camera, my desired f stop works with 1.6mm focal length. BUT since these are all standard sockets, you can interchange lenses. You can get a set of cheapos from Amazon for ~$12 using the magic keywords "CCTV lens set".

  12. anyyankee says:

    >The SDI cameras we use for the DNA Lounge webcast are flaky
    The HD on coax business is a number of new competing standards and I wouldn't invest in any of them. Especially since they aren't as future proof. It's all IP cameras, now. In your position I would scale back to normal coax, which is stable and use an ip video recorder. Then add on ethernet cabling slowly over time. You don't have to put up a dozen cameras all at once.

    >IP cameras are like $25 now.
    The IP cameras that you can get for $25 are garbage. All of them. What you are asking is comparable to "What's the best $25 Multimeter"... For cheap but not shit brands, you are looking at either good cameras from 2 or 3 generations ago that are used (axis), or hikvision or dahua. New Hikvision are around $60-80 each minimum. At this price, you are getting 720p, but you are not getting 2K. If you really want to pay $25 for each camera, I have no idea what you could do other than re-purpose a bunch of old android phones. I've bought cheap cameras, and they have always been extremely limited. You get what you pay for.

    Also, any cameras should be on their own network, or blocked from WAN.

  • Previously