annotate src/com/aurellem/capture/hello/HelloVideo.java @ 10:4c5fc53778c1

moved randelshofer stuff to rightfull place, enabled XuggleVideoRecorder
author Robert McIntyre <rlm@mit.edu>
date Wed, 26 Oct 2011 09:38:27 -0700
parents 5dfc9e768816
children d10f4d4ff15a
rev   line source
rlm@0 1 package com.aurellem.capture.hello;
rlm@0 2
rlm@0 3 import java.io.File;
rlm@0 4 import java.io.IOException;
rlm@0 5
rlm@3 6 import com.aurellem.capture.Capture;
rlm@4 7 import com.aurellem.capture.IsoTimer;
rlm@9 8 import com.aurellem.capture.video.AbstractVideoRecorder;
rlm@0 9 import com.jme3.app.SimpleApplication;
rlm@0 10 import com.jme3.material.Material;
rlm@0 11 import com.jme3.math.ColorRGBA;
rlm@0 12 import com.jme3.math.Vector3f;
rlm@0 13 import com.jme3.scene.Geometry;
rlm@0 14 import com.jme3.scene.shape.Box;
rlm@0 15
rlm@0 16 /** Recording Video from an application suitable for upload to youtube.*/
rlm@0 17 public class HelloVideo extends SimpleApplication {
rlm@0 18
rlm@0 19 /*File staticVideo =
rlm@0 20 new File("/home/r/bullshit.avi");
rlm@0 21 */
rlm@0 22 File movingVideo =
rlm@10 23 new File("/home/r/tmp/bullshit2.flv");
rlm@0 24
rlm@0 25 AbstractVideoRecorder movingRecorder ;
rlm@0 26
rlm@0 27 public static void main(String[] args){
rlm@0 28 HelloVideo app = new HelloVideo();
rlm@0 29 app.start();
rlm@0 30 }
rlm@0 31
rlm@0 32 public void initVideo(){
rlm@0 33 this.setTimer(new IsoTimer(60));
rlm@0 34 /*try{
rlm@0 35 // set the timer to 30fps lock-step
rlm@0 36 this.setTimer(new IsoTimer(30));
rlm@0 37
rlm@0 38 //ViewPort compositeViewPort = renderManager.createFinalView("composite", cam);
rlm@0 39 //compositeViewPort.attachScene(this.rootNode);
rlm@0 40 //compositeViewPort.attachScene(this.guiNode);
rlm@0 41 this.viewPort.setClearFlags(true, true, true);
rlm@0 42 this.viewPort.setBackgroundColor(ColorRGBA.Black);
rlm@0 43 movingRecorder = new AVIVideoRecorder(movingVideo);
rlm@0 44 this.stateManager.attach(movingRecorder);
rlm@0 45 this.viewPort.addFinalProcessor(movingRecorder);
rlm@0 46 this.viewPort.attachScene(this.guiNode);
rlm@0 47
rlm@0 48 }catch (IOException e) {
rlm@0 49 e.printStackTrace();}
rlm@0 50 */
rlm@0 51 try {Capture.SimpleCaptureVideo(this, movingVideo);}
rlm@0 52 catch (IOException e) {e.printStackTrace();}
rlm@0 53
rlm@0 54 }
rlm@0 55 protected Geometry player;
rlm@0 56
rlm@0 57 public void simpleInitApp() {
rlm@0 58 initVideo(); // begin recording!
rlm@0 59 /** this blue box is our player character */
rlm@0 60 Box b = new Box(Vector3f.ZERO, 1, 1, 1);
rlm@0 61 player = new Geometry("blue cube", b);
rlm@0 62 Material mat = new Material(assetManager,
rlm@0 63 "Common/MatDefs/Misc/Unshaded.j3md");
rlm@0 64 mat.setColor("Color", ColorRGBA.Blue);
rlm@0 65 player.setMaterial(mat);
rlm@0 66 rootNode.attachChild(player);
rlm@0 67 }
rlm@0 68
rlm@0 69 /* Use the main event loop to trigger repeating actions. */
rlm@0 70 public void simpleUpdate(float tpf) {
rlm@0 71 // make the player rotate:
rlm@0 72 player.rotate(0, 2*tpf, 0);
rlm@0 73 }
rlm@0 74
rlm@0 75 }