Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Output a Java window as a webcam stream

I would like to write a program perferably in Java that can display animated overlays on a screen.

The screen will then be broadcast streamed over the internet using a separate program called x-split.

A good way to do this would be to create a transparent window in java which will display animated files (with transparancy) and the output of this window (Its display) should ideally appear in the webcam device list so it can be easily picked up by x-split which will allow it to be arranged ontop of the game screen I'm currently broadcasting.

An example program of this type would be one where a webcam image is displayed and "virtual glasses" overlayed over the image of a persons face which could then be transmitted as an output cam.

I have found the java 6u10-translucent-shapes library to create the transparent window but I don't know how to stream it.

I've read a few things to suggest that JMF and FFMpeg might be the way to go, but I'm not sure what to install and how.

Any help or pointers to tutorials would be greatly appreciated.

like image 842
Zac Avatar asked Jan 18 '26 01:01

Zac


2 Answers

I don't know exactly what you are trying to achieve, but what about an external program which streams your screen? Something like http://screen-stream.en.softonic.com ?

like image 140
rdmueller Avatar answered Jan 20 '26 15:01

rdmueller


Use java.awt's Robot class. It has a getScreenCapture(Rectangle) method which can be used to get BufferedImages of a portion of the screen. These BufferedImages can be edited with code, then can made to be flashed by having a full screen application display itself (and disappear to recapture the new Image.). Alternatively, you could filter it by using a transparent java full screen application using the above method, and displaying it on your applet to be "x-treamed".

However, my biggest question is how do you expect to control your game anyway? Also, why are you expected to something this big for something that can be easily solved.

It would be simpler and way more synchronized if you just used a screen recording software to turn it into a movie, then use Windows Movie Maker to modify it to your needs. You do not need to waste your time on code. =)

I hope this helped.

like image 20
KK_ Avatar answered Jan 20 '26 15:01

KK_



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!