Most solutions for using a camera in WSL are to build your own WSL kernel. I have realized it with the steps mentioned in Capturing webcam video with OpenCV in WSL2
However, it's complicated and time-consuming. I want to realize it by sharing video streaming.
Share method
Step1: Run the command below on Windows to check all the camera devices. I see an integrated camera "Integrated Webcam" (video)
in the output.
ffmpeg -list_devices true -f dshow -i dummy
Step2: Check the IP of Ethernet adapter vEthernet (WSL). In my computer, it's 172.24.176.1
Step3: Run the command below on Windows to share video streaming.
ffmpeg -f dshow -i video="Integrated Webcam" -preset ultrafast -tune zerolatency -vcodec libx264 -f mpegts udp://172.24.176.1:5000
Test
Run the command to play the video streaming: ffplay udp://172.24.176.1:5000
It can show the video when the command is run with a terminal of Windows (Win10).
But, it cannot show anything when the command is run on with a terminal of WSL (Ubuntu 22.04). Why?