Underwater IP camera on a beaver lodge

TRLcam

Getting comfortable
Joined
Apr 16, 2014
Messages
292
Reaction score
1,074
Location
Nebraska!
A few years ago a customer approached me about putting camera of some sort on a beaver lodge to record motion and timelapse images. We started off with a couple Sony mirrorless cameras. One for daylight and one that I had modified to respond to 940nm infrared light. Motion was detected using a passive infrared sensor. That worked pretty well and resulted in some amazing images. Then he asked if we could add video in the mix. Rather than add video to the two existing cameras I decided to just add a IP camera. The camera added was a early Dahua 4k IP camera. It worked great. I had it set up to record motion video, shoot timelapse images and record still images. Then I added a encoder to convert the RTSP video to RTMP to send to YouTube Live.

Then about six months ago the idea of putting another IP camera at the same location but underwater. I had a Dahua IPC-HFW4631F-ZSA in the shop from a previous project. So, I removed the camera from the housing and built a submersible housing around it.





The camera was installed on the same post as the existing above water camera.



Both cameras are connected to a control box about 50' away by cat5 cable in a 1" PVC conduit. The system is powered by two 150 watt solar panels connected in series. In the box is a MPPT charge controller, one 100Ah gel storage battery, a 12vdc to 48vdc power converter, a four port POE switch, a CradlePoint cellular router and a the RTSP to RTMP converter. The video converter is just a Raspberry Pi and converts both streams to send on to YouTube Live.




Currently the camera is above water. The water level at the lake dropped during the farm irrigating season. The water is on the rise now and the bottom inch of the camera is now covered. I expect it to be back underwater in the next few weeks. Here is a recording from a few weeks ago made by the underwater camera.


Both cameras are running on the cellular modem so it will drop out and buffer occasionally so, be patient with the stream.

Most of the action above and below water is shortly after sunset and through the night.
 
Last edited:

Hetticles

Getting the hang of it
Joined
Sep 11, 2016
Messages
92
Reaction score
80
Location
Anytown, USA
This is awesome! I would love to have something like this on my beaver lodge.

I am looking into a solar setup, power budget is surely the hardest part. Do they have winter where this is?
Cellular sounds extremely expensive from a dataplan point of view, how is this done?
 

Hetticles

Getting the hang of it
Joined
Sep 11, 2016
Messages
92
Reaction score
80
Location
Anytown, USA
I'm also curious about the ethernet entry into the enclosure, do you have any pictures of that?
 

TRLcam

Getting comfortable
Joined
Apr 16, 2014
Messages
292
Reaction score
1,074
Location
Nebraska!
This is awesome! I would love to have something like this on my beaver lodge.

I am looking into a solar setup, power budget is surely the hardest part. Do they have winter where this is?
Cellular sounds extremely expensive from a dataplan point of view, how is this done?
For solar power I used two 150watt panels connected in series. This runs into a MPPT charge controller to keep a 75Ah deep cycle battery charged. This powers two IP cameras, two 950nm IR flood lights (night only) and one DSLR timelapse camera. The setup is located in central Nebraska so, yes, we do have winter.

The camera was installed for a college that has a unlimited cellular data plan for very little monthly charge. That is the only way this camera is feasible.

The water has been rising the last few days and the camera is half submerged now. On the rear of the housing is a 1/8" aluminum plate fastened to the housing with stainless steel screws. A channel was cut into the PVC for a O-ring to reside between the aluminum and PVC. To feed the cat5e cable into the housing I used a brass plumbing bulkhead fitting. The fitting has a gasket on the inside and outside of the aluminum plate. The inside of the fitting is threaded so I ran the cable through the fitting and sealed with a good grade of caulking. The cat5e cable used was Ubiquiti ToughCable. The cable is not flooded so in the brass bulkhead I separated out each individual conductor and made sure each was surrounded by the sealant. Doing this prevents water from entering the housing if the underwater cable gets damaged. So far, no issues with water ingress.
 

OICU2

BIT Beta Team
Joined
Jan 12, 2016
Messages
821
Reaction score
1,330
Location
USofA
This is neat... can you elaborate more on how you convert from RTSP to RTMP? Does it stream directly to YT Live from the cam? Any issues with it disconnecting from YT?
 

TRLcam

Getting comfortable
Joined
Apr 16, 2014
Messages
292
Reaction score
1,074
Location
Nebraska!
This is neat... can you elaborate more on how you convert from RTSP to RTMP? Does it stream directly to YT Live from the cam? Any issues with it disconnecting from YT?
It's actually a fairly simple process. Install FFMPEG on the Pi and write a simple script to take the RTSP stream from the camera and encode it to RTMP to make YouTube happy. When setting up YouTube Live there is a menu item called "Enable Auto start". Turn this on and if your stream goes away for awhile, it will automatically restart. If the stream is down for a few hours then you will need to restart manually.

 

OICU2

BIT Beta Team
Joined
Jan 12, 2016
Messages
821
Reaction score
1,330
Location
USofA
Is there a certain rpi you would recommend? Or any generic amazon special? I've never dabbled with them yet.
 

TRLcam

Getting comfortable
Joined
Apr 16, 2014
Messages
292
Reaction score
1,074
Location
Nebraska!
Is there a certain rpi you would recommend? Or any generic amazon special? I've never dabbled with them yet.
I typically use the Raspberry Pi 3 model B for most streaming to YouTube. Other than the Pi you will need a good quality micro SD card. I like the Samsung Evo Plus 32gb card. You will also need a 5V power supply capable of supplying at least 2 amps of current. For installation that run 24/7 I like this 5V supply from Amazon.
 
As an Amazon Associate IPCamTalk earns from qualifying purchases.

OICU2

BIT Beta Team
Joined
Jan 12, 2016
Messages
821
Reaction score
1,330
Location
USofA
I typically use the Raspberry Pi 3 model B for most streaming to YouTube. Other than the Pi you will need a good quality micro SD card. I like the Samsung Evo Plus 32gb card. You will also need a 5V power supply capable of supplying at least 2 amps of current. For installation that run 24/7 I like this 5V supply from Amazon.
Do I need a power supply or can I use an a/c adapter with the proper specs?
 
As an Amazon Associate IPCamTalk earns from qualifying purchases.

0blar

Getting the hang of it
Joined
May 17, 2017
Messages
281
Reaction score
34
Hi
Very nice !!
Will it be possible to share your RTSP to RTMP converter script ?
Regards
 

TheWaterbug

Getting comfortable
Joined
Oct 20, 2017
Messages
707
Reaction score
1,522
Location
Palos Verdes
It's actually a fairly simple process. Install FFMPEG on the Pi and write a simple script to take the RTSP stream from the camera and encode it to RTMP to make YouTube happy. When setting up YouTube Live there is a menu item called "Enable Auto start". Turn this on and if your stream goes away for awhile, it will automatically restart. If the stream is down for a few hours then you will need to restart manually.

Did you need to do anything or enable anything to get that "Enable Autostart" to appear in your control panel? I have a very similar setup using an RPi to run a BeeCam and some OwlCams, but since YT killed of the Classic Streaming control a few months ago, I've been needing to manually restart the streams every day:

YouTubeStreamFinished.jpg
Whenever my camera(s) go offline, my YT Studio presents this "stream finished" dialog box-ish thingy, and I need to manually dismiss it before I can start the stream again.

I looked for that Enable Auto-Start option that you have, but my control panel doesn't show it:

YouTubeStreamAdditionalOptions.jpg
 

TheWaterbug

Getting comfortable
Joined
Oct 20, 2017
Messages
707
Reaction score
1,522
Location
Palos Verdes
Will it be possible to share your RTSP to RTMP converter script ?
Here's mine:

Code:
#!/bin/bash
cd /usr/local/bin/
while true
do
./ffmpeg -re -thread_queue_size 512 -rtsp_transport tcp -i "rtsp:/anonymous:password@192.168.1.11:554" -f concat -safe 0 -i playlist.txt -vcodec copy -acodec copy -t 01:47:02 -f flv "rtmp:/a.rtmp.youtube.com/live2/insert-your-streaming-key-here"
sleep 5s
done
I don't really understand ffmpeg that well, so I copied and pasted this script from someone else, and then modified to fit my needs:
  1. If you're using a Raspberry Pi, you will need to compile FFmpeg on the Pi, as I don't believe there is a way to install a precompiled binary or package, but my info might be out of date, as that was as of 2 years ago.
  2. My BeeCam doesn't have an audio feed, and YouTube requires an audio track, so I have a set of royalty-free MP3s from YouTube on the Pi, and the "-f concat -safe 0 -i playlist.txt" tells ffpmeg to play those songs in order. The "-t 01:47:02" is the length of the playlist.
  3. It's in a loop so that it just repeats every 1:47:07 (including the 5 second sleep).
  4. If you use "-vcodec copy -acodec copy", ffmpeg doesn't have to re-encode anything. It just takes the RTSP/MP3 streams and repackages them in FLV format (required by YouTube) for RTMP transport, which means it uses very little CPU. On my little Raspberry Pi 3, one instance of ffmpeg takes about 8-10% of the CPU time, so I can run 3 cameras to 3 YT channels and still have 60+% idle on the Pi.
  5. I'm not really sure what "-re -thread_queue_size 512 -rtsp_transport tcp" do, but I'm loathe to change them because it all works right now.
Here are the results, although it goes off-line from time to time, due to my issues mentioned in my previous post.
 

TRLcam

Getting comfortable
Joined
Apr 16, 2014
Messages
292
Reaction score
1,074
Location
Nebraska!
Did you need to do anything or enable anything to get that "Enable Autostart" to appear in your control panel? I have a very similar setup using an RPi to run a BeeCam and some OwlCams, but since YT killed of the Classic Streaming control a few months ago, I've been needing to manually restart the streams every day:

View attachment 78468
Whenever my camera(s) go offline, my YT Studio presents this "stream finished" dialog box-ish thingy, and I need to manually dismiss it before I can start the stream again.

I looked for that Enable Auto-Start option that you have, but my control panel doesn't show it:

View attachment 78469
When you get to the second picture you posted, click on the "Manage" icon in the upper left corner of your screen. Then click on "Schedule Stream" in the upper right corner of the screen. Follow the instructions and you will get to a screen like you posted above but there will be the "Auto restart" button showing. The auto restart works for a short time after the stream goes down. I'm not sure exactly how long that time is but if the time limit is reached it will delete the live stream and you will need to re-enter it in the studio utility.
 

TheWaterbug

Getting comfortable
Joined
Oct 20, 2017
Messages
707
Reaction score
1,522
Location
Palos Verdes
When you get to the second picture you posted, click on the "Manage" icon in the upper left corner of your screen. Then click on "Schedule Stream" in the upper right corner of the screen. Follow the instructions and you will get to a screen like you posted above but there will be the "Auto restart" button showing. The auto restart works for a short time after the stream goes down. I'm not sure exactly how long that time is but if the time limit is reached it will delete the live stream and you will need to re-enter it in the studio utility.
Thanks! Ah yes, now I see that this option appears only for Scheduled Streams.

Can I ask how you manage the timing of your streams?

In the good old days of Classic Stream Now, I had both a cron job that stopped and started my ffmpeg instances every 12 hours, with a 10 minute pause every time, so that YouTube would have a chance to make a reasonable archive, plus a watchdog script that restarted ffmpeg if it ever went offline for more than 5 minutes.

If I didn't pause it every 12 hours, I'd end up with some archives that were 30-40+ hours long, and they'd get stuck in "processing" purgatory forever.

Both of those methods no longer work with the new YouTube Studio.

For 2 of my applications the archive is really critical for me, because I'm trying to capture events. For example in Spring I set up two cameras outside and inside a "swarm trap," which is basically an empty bee hive that is baited with scent to attract a reproductive swarm of feral bees. I can predict what month they'll move in, but not what day, so I just set it up and let it run 24/7, with the pauses mentioned above.

This is what happens when I get it right.

I want to set that up for my swarm trap again this year, plus I have a similar setup for an Owl Box that I'm hoping will attract a mating pair of Barn Owls.
 
Top