Raspberry Pi Zero as Video Webcam Simulator

Job ID: 39485968

Budget: ₹600 – ₹1,500 INR

Hi,
I’m working on a project where I want my Raspberry Pi Zero 2 W to act as a plug-and-play USB webcam that streams a pre-recorded video to my PC.

Instead of using a real camera module, I want the Pi to stream a video file (like video.mp4) as if it were a live camera feed. When I plug the Pi into my PC via the USB port, the PC should recognize it as a regular webcam and display the video from the file in real-time.... Thinking of it as a real live camera feed.


What I Have Tried:

I enabled OTG (USB device) mode on the Pi
I configured the UVC gadget, v4l2loopback, and ffmpeg
My PC detects the Pi as a USB webcam, but the screen just shows black on camera app of windows — no video plays.
I tried writing the script myself, but it’s not working properly.



My Setup:

Raspberry Pi Zero 2 W
Raspberry Pi OS Legacy (Bullseye 32-bit)
Accessing the Pi through SSH (headless, no monitor attached)
Connected using a USB data cable to the micro USB OTG port


What I Need From You:

A working Bash script that:

1. Sets up everything needed to stream the video file as a USB webcam
2. Configures the necessary modules: UVC gadget, v4l2loopback, ffmpeg, etc.
3. Makes the Pi show up on the PC as a working webcam with video streaming correctly.
4. Lets me easily change parameters like the webcam name, vendor id, product it, video file path, camera resolution, etc.

My previous 2 freelancer failed to deliver this project so,
Please help if it is possible, and let me know if you need more info.
Thanks.