Can I make a video of a running Java Swing application on the fly? -


I have a Java swing GUI program that renders anywhere between 1 to 25 frames per second. It's just a window and there is only one panel in which I do all the rendering, e.g. No other swing components.

I need to be able to produce the test run of my program because it runs. The problem is that regular screen casting tools (such as third-party applications that start before running my favor) often miss some of my frames and I need an exact video.

I know how to use robot class to capture screenshots of my java window but i probably can not save them to disk as i run, it will slow down everything

Thanks

/ Div>

You can use the FEME wrapper in Java - and Java-level Java. Here is the sample code with Xgler.

  Last robot robot = new robot (); Final Toolkit Toolkit = Toolkit.getDefaultToolkit (); Last rectangle screenbank = new rectangle (toolkit.gatescarsius ()); // First of all, create the IMDiAddriter to write the file. Last IMADA Author Writer = Toolfactor Makewear ("output.mp4"); // We tell that we are going to add a video stream at id 0, // position 0, and that the // frames_rat will have a fixed frame rate, the author. Adwi stream (0, 0, frame_rat, screenbank.width , Screenbay.eight); // Now, we are going to loop for a long time. TimeTime = System.Nano Time (); (Int index = 0; index & lt; SECONDS_TO_RUN_FOR * FRAME_RATE.getDouble (); index ++) {// Take a screen shot BufferedImage screen = robot.createScreenCapture (screenbounce); // Change the correct image type BufferedImage bgrscreen = convertToType (screen, BufferedImage.TYPE_3BYTE_BGR); // Stream # 0: Encoder image for author .encode video (0, bdscreen, system. Nanetyim () - starttime, time unit. Nanoscond); System.out.println ("encoded image:" + index); // Sleep Thread.Sleep for framerate milliseconds ((long) (1000 / FRAME_RATE.getDouble ()); } // In the end, we tell the author that if the trailer is to be closed and written then // required authors Close ();  

Another option is a site - but I'm sure it offers what frame rate.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -