Documentation ¶
Overview ¶
Package vcamera creates and streams video to virtual V4L2 capture devices on Linux.
It uses V4L2Loopback to create virtual camera drivers and GStreamer to display test video streams. You can install both using our V4L2Loopback setup script. This script also needs to run `sudo modprobe v4l2loopback`. Since feeding the root password to that command at runtime would be impractical, it's recommended that you allow the current user to run that command without requiring a password. The script above will display a prompt asking if you want this behavior. Select "yes".
Usage:
// create a builder object config := vcamera.Builder() // create 1-to-N cameras config = config.NewCamera(1, "Low-res Camera", vcamera.Resolution{Width: 640, Height: 480}) config = config.NewCamera(2, "Hi-res Camera", vcamera.Resolution{Width: 1280, Height: 720}) ... // start streaming config, err := Stream() if err != nil { // handle error } // shutdown streams config.Shutdown()
Because this class allows for method chaining the above could be accomplished like so
config, err := vcamera.Builder(). NewCamera(1, "Low-res Camera", vcamera.Resolution{Width: 640, Height: 480}). NewCamera(2, "Hi-res Camera", vcamera.Resolution{Width: 1280, Height: 720}). Stream() // DO NOT forget to stop streaming to avoid leaking resources. defer config.Shutdown()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a builder object used to create virtual cameras.
func (*Config) NewCamera ¶
func (c *Config) NewCamera(id int, label string, res Resolution) *Config
NewCamera lazily creates a new camera. No cameras are actually created until Stream is called.
type Resolution ¶
Resolution stores the Width and Height in pixels for a camera resolution.