Using imx519 as a WebCam

Hello, I finally got some success with the following configurations:

Note that this solution fails on any Macs (with Intel or Apple Silicon processor) running either macOS BigSur (11.7), Catalina (10.15) or below. I was initially using those older macOS versions and could not get the RPi with the IMX519 working as a WebCam, though they could work with a OV5647 module and an older version of raspios-buster 32-bit.

First, follow the instructions from “Plug-and-play Raspberry Pi USB webcam” website (Plug-and-play Raspberry Pi USB webcam - Raspberry Pi):

sudo apt update
echo "dtoverlay=dwc2,dr_mode=otg" | sudo tee -a /boot/config.txt
sudo apt install git meson libcamera-dev libjpeg-dev
git clone https://gitlab.freedesktop.org/camera/uvc-gadget.git
cd uvc-gadget
make uvc-gadget
cd build
sudo meson install
sudo ldconfig
cd

sudo nano rpi-uvc-gadget.sh
=> Copy/paste the rpi-uvc-gadget.sh script from the website. However, replace the lines
         between the 2 lines showing “mkdir functions/$FUNCTION” with the following 2 lines:

	create_frame $FUNCTION 1280 720 uncompressed u "166666"
	create_frame $FUNCTION 1280 720 mjpeg m "166666"

sudo chmod 777 rpi-uvc-gadget.sh
sudo nano /etc/rc.local
=> copy/paste the  /etc/rc.local script from the website.

sudo reboot

You should be able to connect the RPi to a host computer and use its attached camera as a WebCam if using a OV5647 camera module.

To add support for the 16MP Arducam IMX519 camera module:

wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh
chmod +x install_pivariety_pkgs.sh
./install_pivariety_pkgs.sh -p libcamera
./install_pivariety_pkgs.sh -p libcamera_apps

sudo nano /boot/config.txt
=> add after the last [all]:

	dtoverlay=imx519

sudo reboot

You should be able to connect the RPi to a host computer and use its attached camera as a WebCam if using Arducam IMX519 camera module.

To switch support between the OV5647 and the IMX519:

- IMX519 (Autofocus focus), add in /boot/config.txt:

	dtoverlay=imx519

- IMX519 NOIR (fixed focus), add in /boot/config.txt:

	dtoverlay=imx519,vcm=off

- OV5647: comment the imx519 line in /boot/config.txt

	#dtoverlay=imx519 

Hope this helps!

1 Like