Class MjpegServer

  • All Implemented Interfaces:
    AutoCloseable

    public class MjpegServer
    extends VideoSink
    A sink that acts as a MJPEG-over-HTTP network server.
    • Constructor Detail

      • MjpegServer

        public MjpegServer​(String name,
                           String listenAddress,
                           int port)
        Create a MJPEG-over-HTTP server sink.
        Parameters:
        name - Sink name (arbitrary unique identifier)
        listenAddress - TCP listen address (empty string for all addresses)
        port - TCP port number
      • MjpegServer

        public MjpegServer​(String name,
                           int port)
        Create a MJPEG-over-HTTP server sink.
        Parameters:
        name - Sink name (arbitrary unique identifier)
        port - TCP port number
    • Method Detail

      • getListenAddress

        public String getListenAddress()
        Get the listen address of the server.
      • getPort

        public int getPort()
        Get the port number of the server.
      • setResolution

        public void setResolution​(int width,
                                  int height)
        Set the stream resolution for clients that don't specify it.

        It is not necessary to set this if it is the same as the source resolution.

        Setting this different than the source resolution will result in increased CPU usage, particularly for MJPEG source cameras, as it will decompress, resize, and recompress the image, instead of using the camera's MJPEG image directly.

        Parameters:
        width - width, 0 for unspecified
        height - height, 0 for unspecified
      • setFPS

        public void setFPS​(int fps)
        Set the stream frames per second (FPS) for clients that don't specify it.

        It is not necessary to set this if it is the same as the source FPS.

        Parameters:
        fps - FPS, 0 for unspecified
      • setCompression

        public void setCompression​(int quality)
        Set the compression for clients that don't specify it.

        Setting this will result in increased CPU usage for MJPEG source cameras as it will decompress and recompress the image instead of using the camera's MJPEG image directly.

        Parameters:
        quality - JPEG compression quality (0-100), -1 for unspecified
      • setDefaultCompression

        public void setDefaultCompression​(int quality)
        Set the default compression used for non-MJPEG sources. If not set, 80 is used. This function has no effect on MJPEG source cameras; use SetCompression() instead to force recompression of MJPEG source images.
        Parameters:
        quality - JPEG compression quality (0-100)