本文整理汇总了Java中org.monte.media.VideoFormatKeys类的典型用法代码示例。如果您正苦于以下问题:Java VideoFormatKeys类的具体用法?Java VideoFormatKeys怎么用?Java VideoFormatKeys使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VideoFormatKeys类属于org.monte.media包,在下文中一共展示了VideoFormatKeys类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MonteScreenRecorder
import org.monte.media.VideoFormatKeys; //导入依赖的package包/类
public MonteScreenRecorder() {
GraphicsConfiguration gc = GraphicsEnvironment
.getLocalGraphicsEnvironment().getDefaultScreenDevice()
.getDefaultConfiguration();
this.files = new TreeSet<File>();
try {
this.screenRecorder = new ScreenRecorder(gc, new Format(
MediaTypeKey, MediaType.FILE, MimeTypeKey, FormatKeys.MIME_QUICKTIME),
new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey,
VideoFormatKeys.ENCODING_QUICKTIME_ANIMATION,
CompressorNameKey,
ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, DepthKey,
24, FrameRateKey, Rational.valueOf(15), QualityKey,
1.0f, KeyFrameIntervalKey, 15 * 60), new Format(
MediaTypeKey, MediaType.VIDEO, EncodingKey,
"black", FrameRateKey, Rational.valueOf(30)), null);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例2: makeAVI
import org.monte.media.VideoFormatKeys; //导入依赖的package包/类
public static void makeAVI(Iterator<BufferedImage> images, float frameRate, File file, EventListener evl) throws IOException {
if (!images.hasNext()) {
return;
}
AVIWriter out = new AVIWriter(file);
BufferedImage img0 = images.next();
out.addVideoTrack(VideoFormatKeys.ENCODING_AVI_PNG, 1, (int) frameRate, img0.getWidth(), img0.getHeight(), 0, 0);
try {
out.write(0, img0, 1);
while (images.hasNext()) {
out.write(0, images.next(), 1);
}
} finally {
out.close();
}
}
示例3: writeImage
import org.monte.media.VideoFormatKeys; //导入依赖的package包/类
@Override
public void writeImage(List<BufferedImage> frames, OutputStream out, Integer frameRate) throws IOException {
if (frames == null || frames.size() == 0) {
throw new IllegalArgumentException("Cannot create an animation with no images");
}
try{
int width = frames.get(0).getWidth();
int height = frames.get(0).getHeight();
Format format = new Format(VideoFormatKeys.EncodingKey, VideoFormatKeys.ENCODING_AVI_DIB,
VideoFormatKeys.DepthKey, 24, VideoFormatKeys.MediaTypeKey, MediaType.VIDEO,
VideoFormatKeys.FrameRateKey, new Rational(frameRate), VideoFormatKeys.WidthKey, width,
VideoFormatKeys.HeightKey, height);
AVIWriter writer = new AVIWriter(new MemoryCacheImageOutputStream(out));
writer.addTrack(format);
writer.setPalette(0, frames.get(0).getColorModel());
for(BufferedImage frame : frames){
writer.write(0, frame, 1);
}
writer.write(0, frames.get(frames.size()-1), 1);
writer.close();
} catch(Exception e){
e.printStackTrace();
}
}
示例4: main
import org.monte.media.VideoFormatKeys; //导入依赖的package包/类
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
int w = 400, h = 400;
// Set up movie writer
AVIWriter out = new AVIWriter(new File("Test RLE blue.avi"));
out.addVideoTrack(VideoFormatKeys.ENCODING_AVI_DIB, 1, 25, w, h, 8, 25);
out.setPalette(0, Colors.createMacColors());
// Set up image
BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_BYTE_INDEXED, Colors.createMacColors());
Graphics2D g = img.createGraphics();
g.setBackground(Color.BLUE);
g.clearRect(0, 0, w, h);
out.write(0, img, 1);
try {
Point[] p = {new Point(10, 10), new Point(390, 10), new Point(390, 390), new Point(10, 390)};
for (int i = 0; i <= p.length; i++) {
if (i > 0) {
g.setColor(Color.BLUE);
g.fillRect(p[i - 1].x, p[i - 1].y, 1, 1);
}
if (i < p.length) {
g.setColor(Color.YELLOW);
g.fillRect(p[i].x, p[i].y, 1, 1);
}
out.write(0, img, 1);
}
} finally {
out.close();
}
g.dispose();
} catch (Throwable t) {
t.printStackTrace();
}
}