com.aurellem.capture
Class Capture
java.lang.Object
com.aurellem.capture.Capture
public class Capture
- extends java.lang.Object
Use the methods in this class for capturing consistent, high quality video
and audio from a jMonkeyEngine3 application. To capture audio or video do
the following:
1.) Set your application's timer to an IsoTimer. Create the IsoTimer with the
desired video frames-per-second.
2.) Call captureAudio and/or captureVideo on the Application as desired
before starting the Application.
See the Basic and Advanced demos in the examples section for more
information. If you have any trouble, please PM me on the jMonkeyEngine
forums. My username is bortreb.
- Author:
- Robert McIntyre
Method Summary |
static void |
captureAudio(com.jme3.app.Application app,
java.io.File file)
Use this function to capture audio from your application. |
static void |
captureVideo(com.jme3.app.Application app,
java.io.File file)
Use this function to capture video from your application. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Capture
public Capture()
captureVideo
public static void captureVideo(com.jme3.app.Application app,
java.io.File file)
throws java.io.IOException
- Use this function to capture video from your application. You
specify the framerate at which the video will be recording by setting
the Application's timer to an IsoTimer created with the desired
frames-per-second.
There are three ways to record and they are selected by the
properties of the file that you specify.
1.) (Preferred) If you supply an empty directory as the file, then
the video will be saved as a sequence of .png files, one file per
frame. The files start at 0000000.png and increment from there.
You can then combine the frames into your preferred
container/codec. If the directory is not empty, then writing
video frames to it will fail, and nothing will be written.
2.) If the filename ends in ".avi" then the frames will be encoded as
a RAW stream inside an AVI 1.0 container. The resulting file
will be quite large and you will probably want to re-encode it to
your preferred container/codec format. Be advised that some
video payers cannot process AVI with a RAW stream, and that AVI
1.0 files generated by this method that exceed 2.0GB are invalid
according to the AVI 1.0 spec (but many programs can still deal
with them.) Thanks to Werner Randelshofer for his excellent work
which made AVI file writer option possible.
3.) Any non-directory file ending in anything other than ".avi" will
be processed through Xuggle. Xuggle provides the option to use
many codecs/containers, but you will have to install it on your
system yourself in order to use this option. Please visit
http://www.xuggle.com/ to learn how to do this.
- Parameters:
app
- The Application from which you wish to record Video.file
- The file to which the video will be captured.
- Throws:
java.io.IOException
captureAudio
public static void captureAudio(com.jme3.app.Application app,
java.io.File file)
throws java.io.IOException
- Use this function to capture audio from your application. Audio data
will be saved in linear PCM format at 44,100 hertz in the wav container
format to the file that you specify.
Note that you *have* to use an IsoTimer for your Application's timer
while recording audio or the recording will fail. Also ensure that your
IsoTimer obeys the following constraints:
1.) The frames-per-second value of the IsoTimer cannot be lower than 10
frames-per-second.
2.) The frames-per-second value of the IsoTimer must evenly divide
44,100.
- Parameters:
app
- The Application from which you wish to record Audio.file
- the target file to which you want to record audio data.
- Throws:
java.io.IOException