我有一个 JFrame 应用程序,可以生成长时间运行的输出。我想知道我是否可以录制该内容并生成高帧速率的视频或帧/图像,以便稍后将它们转换为视频?
最佳答案
您可以像这样生成 JFrame
内容的图像:
public static void main(String[] a) throws Exception {
final JFrame frame = new JFrame("My Frame");
frame.getContentPane().setBackground(Color.CYAN);
frame.setSize(400, 400);
frame.setVisible(true);
final BufferedImage image = new BufferedImage(frame.getWidth(),
frame.getHeight(), BufferedImage.TYPE_INT_ARGB);
frame.paint(image.getGraphics());
File outputfile = new File("C:/Temp/frame.png");
ImageIO.write(image, "png", outputfile);
}
然后使用任何可用的软件转换器来构建视频。
关于java - 从 JFrame 录制视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36422170/