The sane solution to capturing wildlife going through your garden is to use a dedicated wildlife camera. In my experience these things are pretty much always trash. The devices I've seen are all basically cheap dash-cam boards that happen to have motion detection on it and produce the image quality of a 2001 webcam.

It's also a bit wasteful to get a new device to capture video when I already have several of those that produce way better quality, they just lack the features for it. For this specifically I want to use the Blackmagic Design Pocket Cinema Camera 4k, or bmpcc4k for short because that's a ridiculous name.

With recent firmware updates this camera has gained a few interesting features for doing this, the first one is that it has an USB webcam mode and the second is the REST api for controlling the camera.

To add the motion detection capabilities to this camera I connect it to a laptop with a USB cable and run motion on it which is usually for using webcams and network cameras as a security camera. The trick to making this work is disabling all the recording methods in the software and using the shell hooks to send API commands to the camera when an event is detected.

The config file I'm using with motion is:

daemon off
setup_mode off
log_level 6

# Find video device with lsplug -rd
video_device /dev/video2

# The bmpcc4k always outputs 1080p on the webcam
width 1920
height 1080
framerate 30

# Show the motion view in the web ui
stream_preview_method 3

# Detection threshold for the motion detection
threshold 1500
minimum_motion_frames 1
despeckle_filter EedDl

# The event ends after 4 seconds of no motion
event_gap 4

# Don't store recordings, the camera does that
picture_output off
movie_output off

# Send commands to the API to start and stop recording
on_event_start curl --request POST http://172.26.209.29/control/api/v1/transports/0/record
on_event_end curl --request POST http://172.26.209.29/control/api/v1/transports/0/stop

# Enable the webinterface for monitoring
webcontrol_port 8080
webcontrol_localhost off
stream_port 8081
stream_localhost off
stream_maxrate 15

The IP address used to communicate with the camera here is the one for the USB network interface created by the camera. In my case the IP address is the same after re-plugging it but it might be different for your camera. The DHCP server in the camera gives your computer a /30 address (in my case my laptop got 172.26.209.30/30) and since this subnet size allows for two machines the only other one is the camera. In practice just substract 1 from the ip address received from the camera.

So far I haven't been able to capture the squirrel, but at least the setup is working as it did capture some birds.