# Membrane Camera Capture Plugin

[![API Docs](](

This plugin can be used to capture video stream from an input device.

It is part of [Membrane Multimedia Framework](

## Installation

Add the following line to your `deps` in `mix.exs`. Run `mix deps.get`.

	{:membrane_camera_capture_plugin, "~> 0.7.2"}

This package depends on the [ffmpeg]( libraries. The precompiled builds will be pulled and linked automatically. However, should there be any problems, consider installing it manually.

### Manual installation of dependencies
#### Ubuntu

sudo apt-get install ffmpeg

#### Arch/Manjaro

pacman -S ffmpeg

#### MacOS

brew install ffmpeg

## Sample Usage

This example displays the stream from your camera on the screen:

Logger.configure(level: :info)

  {:membrane_camera_capture_plugin, "~> 0.7.1"},

defmodule Example do
  use Membrane.Pipeline

  @impl true
  def handle_init(_ctx, _options) do
    spec =
      |> child(%Membrane.FFmpeg.SWScale.PixelFormatConverter{format: :I420})
      |> child(Membrane.SDL.Player)

    {[spec: spec], %{}}



## Testing

To run manual tests, you need to install dependencies:

$ mix deps.get

And run manual (you observe the result and decide whether it works) tests:

$ mix test --include manual

If it runs successfully, you should be able to see video from your camera.

_You might be asked to grant access to your camera, as some operating systems require that_

_In case of the absence of a physical camera, it is necessary to use a virtual camera (e.g. OBS, [see how to set up the virtual camera in OBS](

## Copyright and License

Copyright 2022, [Software Mansion](

[![Software Mansion](](

Licensed under the [Apache License, Version 2.0](LICENSE)