Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/membraneframework/membrane_rpicam_plugin
Membrane rpicam plugin
https://github.com/membraneframework/membrane_rpicam_plugin
Last synced: 2 days ago
JSON representation
Membrane rpicam plugin
- Host: GitHub
- URL: https://github.com/membraneframework/membrane_rpicam_plugin
- Owner: membraneframework
- License: apache-2.0
- Created: 2023-11-20T16:12:50.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2023-12-15T10:29:44.000Z (11 months ago)
- Last Synced: 2024-03-15T13:07:26.789Z (8 months ago)
- Language: Elixir
- Homepage:
- Size: 34.2 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Membrane Rpicam Plugin
[![Hex.pm](https://img.shields.io/hexpm/v/membrane_rpicam_plugin.svg)](https://hex.pm/packages/membrane_rpicam_plugin)
[![API Docs](https://img.shields.io/badge/api-docs-yellow.svg?style=flat)](https://hexdocs.pm/membrane_rpicam_plugin)
[![CircleCI](https://circleci.com/gh/membraneframework/membrane_rpicam_plugin.svg?style=svg)](https://circleci.com/gh/membraneframework/membrane_rpicam_plugin)Membrane Rpicam Plugin allows capturing video from official RaspberryPi camera module using [rpicam-apps](https://github.com/raspberry-pi/rpicam-apps) (formerly libcamera-apps). This plugin can also be used on devices running [Nerves](https://nerves-project.org).
## Installation
The package can be installed by adding `membrane_rpicam_plugin` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:membrane_rpicam_plugin, "~> 0.1.5"}
]
end
```The package depends on rpicam-apps that need to be present on the target system.
## Usage
The following script creates and starts a pipeline capturing 5 seconds from the RaspberryPi camera module and saving it to `/data/output.h264`:
```elixir
defmodule Rpicam.Pipeline do
use Membrane.Pipeline
@impl true
def handle_init(_ctx, _opts) do
spec =
child(:source, %Membrane.Rpicam.Source{timeout: 5000})
|> child(:sink, %Membrane.File.Sink{location: "/data/output.h264"}){[spec: spec], %{}}
end@impl true
def handle_element_end_of_stream(:sink, _pad, _ctx, state) do
{[terminate: :normal], state}
end@impl true
def handle_element_end_of_stream(_child, _pad, _ctx, state) do
{[], state}
end
end# Start and monitor the pipeline
{:ok, _supervisor_pid, pipeline_pid} = Membrane.Pipeline.start_link(Rpicam.Pipeline)
ref = Process.monitor(pipeline_pid)# Wait for the pipeline to finish
receive do
{:DOWN, ^ref, :process, _pipeline_pid, _reason} ->
:ok
end
```## Copyright and License
Copyright 2022, [Software Mansion](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=membrane_rpicam_plugin)
[![Software Mansion](https://logo.swmansion.com/logo?color=white&variant=desktop&width=200&tag=membrane-github)](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=membrane_rpicam_plugin)
Licensed under the [Apache License, Version 2.0](LICENSE)