Sorry, I was following this and had a bit more trouble just writing
that out. For now, all I want to do is just print out each frame that
I reach in the movie. This class was a tester that I came up with
based on your example code above:
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.IntBuffer;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import org.gstreamer.GMainLoop;
import org.gstreamer.Gst;
import org.gstreamer.PlayBin;
import org.gstreamer.elements.RGBDataSink;
import org.gstreamer.media.MediaPlayer;
import org.gstreamer.swing.GstVideoPlayer;
public class GStreamSample {
public GStreamSample()
{
}
public static void main(String[] args) {
//System.setProperty("sun.java2d.opengl", "True");
final GMainLoop loop = new GMainLoop();
final String file = args[0];
PlayBin player = new PlayBin("Video Data Extractor");
RGBDataSink videoSink = new RGBDataSink("rgb",
new RGBDataSink.Listener() {
public void rgbFrame(int w, int h, IntBuffer
rgbPixels) {
System.out.println("Got to a frame.");
File outputFile = new File(System.currentTimeMillis()
+".png"); // create a File Object
BufferedImage bufferedImage = new BufferedImage(w, h,
BufferedImage.TYPE_INT_ARGB);
bufferedImage.setRGB(0, 0, w, h, rgbPixels.array(), 0, w);
try {
javax.imageio.ImageIO.write(bufferedImage, "PNG",
outputFile);
} catch (IOException e) {
e.printStackTrace();
}
}
}
);
player.setVideoSink(videoSink);
player.setInputFile(new File(file));
loop.startInBackground();
}
}
However, this program just exits and doesn't produce any PNG files,
instead it just dies quietly. When I used a debugger to see what was
happening, I saw that it was falling right through. I think there is
something obvious that is missing. I am new to this package and
haven't worked with it before so any help would be appreciated.
On Dec 6, 5:36 am, "Wayne Meissner" <
wmeiss...@gmail.com> wrote:
> Ahh, yeh. The rough rule of thumb is: when using code from svn, use the
> libraries under lib/ in the tree. The binary releases of jna on
> gstreamer-java download page match up with the binary releases of
> gstreamer-java.
>
> Great to see that its working for you. Send a screenshot of it doing
> something cool.
>