Skip to content

Membrane framework plugin to support S3 sources/destinations

License

Notifications You must be signed in to change notification settings

YuzuTen/membrane_s3_plugin

Repository files navigation

Membrane S3 Plugin

Membrane S3 Plugin CI Workflow Hex.pm API Docs

This plugin provides a Membrane Sink that writes to Amazon S3, or other object stores that use the AWS S3 API. It will eventually also provide a membrane Source that reads from S3, but my current project doesn't need it yet.

It is designed to work with the Membrane Multimedia Framework.

Installation

The package can be installed by adding membrane_s3_plugin to your list of dependencies in mix.exs:

def deps do
  [
    {:membrane_s3_plugin, "~> 0.1"}
  ]
end

This library depends on ex_aws_s3 and ex_aws. ex_aws requires a http client. The default is hackney.

If you are content with hackney as your http client, add {:hackney, "~> 1.18"} to your list of dependencies in mix.exs. For other http clients, you may override the :ex_aws, :http_client configuration to point to a module that implements the ExAws.Request.HttpClient behavior.

Because this library does no transcoding or packaging, no non-BEAM dependencies are required.

Usage example

If you have AWS environment variables set up (see ExAws documentation), and include the membrane_file_plugin in your mix.exs dependencies, you can write a simple pipeline to write to S3:

defmodule Membrane.ReleaseTest.Pipeline do
  use Membrane.Pipeline

  alias Membrane.S3.Sink

  @impl true
  def handle_init(_) do
    children = [
      source: %Membrane.File.Source{
        location: "/tmp/input.raw"
      },
      sink: %Membrane.S3.Sink{
          bucket: "membrane-s3-plugin-test-bucket-us-east-1",
          path: "example.txt",
      }
    ]

    links = [
      link(:source)
      |> to(:sink)
    ]

    {{:ok, spec: %ParentSpec{children: children, links: links}}, %{}}
  end
end

More complex pipelines can be constructed by adding transcoders, packaging, and other components, and linking them together. This minimalist example demonstrates how to construct a pipeline with no intermediate processing.

For additional configuration options, including alternate mechanisms, view the documentation.

Contributing

  1. Fork the repository.
  2. Clone the fork.
  3. Make your changes.
  4. Make sure to run mix format, mix credo and mix dialyzer and fix any issues that crop up.
  5. Commit your changes. Add tests, please!
  6. Create a pull request.

Documentation

Documentation can be generated with ExDoc.

The documentation is also published on HexDocs.

Changelog

Release history is in the project Changelog.

Copyright and License

© 2022 YuzuTen LLC. Licensed under the Apache license.

This plugin was originally written by Jason Truesdell with support from IndustrialML, Inc.

About

Membrane framework plugin to support S3 sources/destinations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages