Search in sources :

Example 6 with FFmpegFrameGrabber

use of org.bytedeco.javacv.FFmpegFrameGrabber in project bigbluebutton by bigbluebutton.

the class FfmpegScreenshare method setupLinuxGrabber.

private FFmpegFrameGrabber setupLinuxGrabber(int width, int height, int x, int y) {
    // ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 output.mp4
    // This will grab the image from desktop, starting with the upper-left corner at (x=100, y=200) 
    // with the width and height of 1024x768.
    String inputDevice = ":";
    if (ssi.fullScreen) {
        inputDevice = inputDevice.concat(new Integer(0).toString()).concat(".").concat(new Integer(0).toString());
        inputDevice = inputDevice.concat("+").concat(new Integer(0).toString()).concat(",").concat(new Integer(0).toString());
    } else {
        inputDevice = inputDevice.concat(new Integer(0).toString()).concat(".").concat(new Integer(0).toString());
        inputDevice = inputDevice.concat("+").concat(new Integer(x).toString()).concat(",").concat(new Integer(y).toString());
    }
    String videoSize = new Integer(width).toString().concat("x").concat(new Integer(height).toString());
    System.out.println("Setting up grabber for linux.");
    System.out.println("input:" + inputDevice + " videoSize:" + videoSize);
    FFmpegFrameGrabber linuxGrabber = new FFmpegFrameGrabber(inputDevice);
    linuxGrabber.setImageWidth(width);
    linuxGrabber.setImageHeight(height);
    linuxGrabber.setOption("video_size", videoSize);
    linuxGrabber.setFormat("x11grab");
    return linuxGrabber;
}
Also used : FFmpegFrameGrabber(org.bytedeco.javacv.FFmpegFrameGrabber)

Example 7 with FFmpegFrameGrabber

use of org.bytedeco.javacv.FFmpegFrameGrabber in project bigbluebutton by bigbluebutton.

the class FfmpegScreenshare method setupMacOsXGrabber.

private FFmpegFrameGrabber setupMacOsXGrabber(int width, int height, int x, int y) {
    //ffmpeg -f avfoundation -i "Capture screen 0" test.mkv
    String inputDevice = "Capture screen 0:none";
    String videoSize = new Integer(width).toString().concat("x").concat(new Integer(height).toString());
    System.out.println("Setting up grabber for macosx.");
    System.out.println("input:" + inputDevice + " videoSize:" + videoSize);
    FFmpegFrameGrabber macGrabber = new FFmpegFrameGrabber(inputDevice);
    macGrabber.setImageWidth(width);
    macGrabber.setImageHeight(height);
    macGrabber.setFrameRate(frameRate);
    macGrabber.setPixelFormat(AV_PIX_FMT_RGB0);
    macGrabber.setFormat("avfoundation");
    macGrabber.setOption("capture_cursor", "1");
    macGrabber.setOption("capture_mouse_clicks", "1");
    return macGrabber;
}
Also used : FFmpegFrameGrabber(org.bytedeco.javacv.FFmpegFrameGrabber)

Aggregations

FFmpegFrameGrabber (org.bytedeco.javacv.FFmpegFrameGrabber)7 Frame (org.bytedeco.javacv.Frame)3 FrameGrabber (org.bytedeco.javacv.FrameGrabber)2 BufferedImage (java.awt.image.BufferedImage)1 ByteBuffer (java.nio.ByteBuffer)1 ShortBuffer (java.nio.ShortBuffer)1 ExecutorService (java.util.concurrent.ExecutorService)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Scene (javafx.scene.Scene)1 Image (javafx.scene.image.Image)1 ImageView (javafx.scene.image.ImageView)1 StackPane (javafx.scene.layout.StackPane)1 AudioFormat (javax.sound.sampled.AudioFormat)1 DataLine (javax.sound.sampled.DataLine)1 SourceDataLine (javax.sound.sampled.SourceDataLine)1 StatusResult (org.brunocvcunha.instagram4j.requests.payload.StatusResult)1 Pointer (org.bytedeco.javacpp.Pointer)1 Java2DFrameConverter (org.bytedeco.javacv.Java2DFrameConverter)1 JavaFXFrameConverter (org.bytedeco.javacv.JavaFXFrameConverter)1