예제 #1
0
  /*  Encodes parameter BuggeredImage to video 'outputFilename'.
   *  Returns video file 'outputFilename' when parameter is null.
   */
  public void addImage(BufferedImage image, long timestamp) {
    if (image != null) {
      BufferedImage bgrScreen = convertToType(image, BufferedImage.TYPE_3BYTE_BGR);

      /*int scaleX = (int) (1910);
      int scaleY = (int) (1080);
      Image img = bgrScreen.getScaledInstance(scaleX, scaleY, Image.SCALE_SMOOTH);
      BufferedImage buffered = new BufferedImage(scaleX, scaleY, BufferedImage.TYPE_3BYTE_BGR);
      buffered.getGraphics().drawImage(img, 0, 0 , null);*/

      // try{
      // writer.encodeVideo(0, bgrScreen, counter_mil,
      //           TimeUnit.MICROSECONDS);
      writer.encodeVideo(0, bgrScreen, timestamp, TimeUnit.MILLISECONDS);
      // }
      // catch(BufferOverflowException e){

      // }
      // writer.encodeVideo(0, bgrScreen, counter_mil,
      //		TimeUnit.MICROSECONDS);
      // System.out.println("ImageToVideo: "+ counter_mil);
      // counter_mil += 80;
      // counter_mil += v_MICRO_SECONDS_BETWEEN_FRAMES;
    }
  }
예제 #2
0
 /*
  * Will create a writer for file named 'outputFilename'
  */
 public ImageToVideo(String Filename, double interval, int width, int height) {
   outputFilename = Filename;
   v_MICRO_SECONDS_BETWEEN_FRAMES = interval;
   // let's make a IMediaWriter to write the file.
   writer = ToolFactory.makeWriter(outputFilename);
   // We tell it we're going to add one video stream, with id 0,
   // at position 0, and that it will have a fixed frame rate of FRAME_RATE.
   // 4th and 5th parameter are width and height of the created video.
   writer.addVideoStream(0, 0, width, height);
   // writer.addVideoStream(0, 0, 100, 100);
   // System.err.println("hello");
 }