Class CaptureInput<T extends CaptureInput<T>>

Type Parameters:
T - self
All Implemented Interfaces:
Input
Direct Known Subclasses:
CaptureInput.LinuxX11Grab, CaptureInput.MacOsAvFoundation, CaptureInput.WindowsDirectShow, CaptureInput.WindowsGdiGrab

public abstract class CaptureInput<T extends CaptureInput<T>> extends BaseInput<T> implements Input
This Input provides a live capture of your computer desktop as source.

Most of the information comes from ffmpeg capture desktop documentation

TODO list: - Screen selection when multiscreen? - Audio Capture? - Call ffmpeg to return list of devices? list of screens?

  • Constructor Details

    • CaptureInput

      protected CaptureInput(String input)
      Parameters:
      input - input identifier
  • Method Details

    • setCaptureFrameRate

      public CaptureInput<T> setCaptureFrameRate(Number value)
      Set capture frame rate.

      Captures the desktop at the given frame rate

      Be careful not to specify framerate with the "-r" parameter, like this "ffmpeg -f dshow -r 7.5 -i video=XXX". This actually specifies that the devices incoming PTS timestamps be ignored and replaced as if the device were running at 7.5 fps [so it runs at default fps, but its timestamps are treated as if 7.5 fps]. This can cause the recording to appear to have "video slower than audio" or, under high cpu load (if video frames are dropped) it will cause the video to fall "behind" the audio [after playback of the recording is done, audio continues on--and gets highly out of sync, video appears to go into "fast forward" mode during high cpu scenes].

      Parameters:
      value - Hz value, fraction or abbreviation
      Returns:
      this
    • setFrameRate

      public T setFrameRate(String streamSpecifier, Number value)
      Be careful not to specify framerate with the "-r" parameter, like this "ffmpeg -f dshow -r 7.5 -i video=XXX". This actually specifies that the devices incoming PTS timestamps be ignored and replaced as if the device were running at 7.5 fps [so it runs at default fps, but its timestamps are treated as if 7.5 fps]. This can cause the recording to appear to have "video slower than audio" or, under high cpu load (if video frames are dropped) it will cause the video to fall "behind" the audio [after playback of the recording is done, audio continues on--and gets highly out of sync, video appears to go into "fast forward" mode during high cpu scenes].
      Overrides:
      setFrameRate in class BaseInOut<T extends CaptureInput<T>>
      Parameters:
      streamSpecifier - stream specifier
      value - Hz value, fraction or abbreviation
      Returns:
      this
      See Also:
    • setCaptureVideoSize

      public CaptureInput<T> setCaptureVideoSize(int width, int height)
      Set the video size in the captured video.
      Parameters:
      width - width
      height - height
      Returns:
      this
    • setCaptureVideoSize

      public CaptureInput<T> setCaptureVideoSize(String size)
      Sets the video size in the captured video given as a String such as 640x480 or hd720.
      Parameters:
      size - video size
      Returns:
      this
    • setCaptureVideoOffset

      public abstract CaptureInput<T> setCaptureVideoOffset(int xOffset, int yOffset)
      Sets the video region offsets.

      Note: this option doesn't work for some capture devices.

      Parameters:
      xOffset - x offset
      yOffset - y offset
      Returns:
      this
    • setCaptureCursor

      public abstract CaptureInput<T> setCaptureCursor(boolean captureCursor)
      Instructs ffmpeg to capture mouse cursor.

      Note: this feature is not supported on all devices.

      Parameters:
      captureCursor - true to capture cursor
      Returns:
      this
    • captureDesktop

      public static CaptureInput<?> captureDesktop()
      Creates CaptureInput with automatically selected capture device.

      Note: consider using concrete subclass factory methods.

      Returns:
      CaptureInput
      See Also: