Search code examples
javacameradriverjava-17virtual-webcam

How to create a new camera source in Java?


I am trying to create a new camera source or driver in java. There is a similar question based on python. What am trying to do is that I want a new camera source shown in windows so that all apps can connect to it. And the output will be many images showing in a loop instead of live camera. Can I achieve this with java? If yes How? In stackoverflow there are many questions based on c++. But not about Java. I am trying to achieve this in Java. I think for this I need to use something like directX.

I know how to create the loop of images. But How to create a camera source?


Solution

  • May be you could divide your problem in two parts:

    1. Using a tool for creating virtual webcam video source rather than trying to create a driver from scratch. As discussed in many questions, for example this, you can use the following tool to create a virtual Direct Show source: DirectShow Video Source Filter for JPEG and M-JPEG IP Cameras

    2. Using another tool like ffmpeg to generate a real time mpegts udp stream from your images (as shown in this question). That stream is the one that the virtual camera source will read from.

    You could even use Java to create the stream on point 2, using some library like this (not tested by me).