# Membrane Framerate Converter Plugin

[![API Docs](](

Plugin providing element for converting frame rate of raw video stream.

It is part of [Membrane Multimedia Framework](

## Installation

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

def deps do
    {:membrane_framerate_converter_plugin, "~> 0.5.1"}

## Description

Element converts video to target constant frame rate, by dropping and duplicating frames as necessary
(input video may have constant or variable frame rate).

## Usage

Example converting h264 video from 10 to 2 fps.

defmodule Pipeline do
  use Membrane.Pipeline

  alias Membrane.H264.FFmpeg.{Parser, Decoder, Encoder}
  alias Membrane.File.{Sink, Source}

  @impl true
  def handle_init(filename) do
    children = %{
        file: %Source{chunk_size: 40_960, location: filename},
        parser: %Parser{framerate: {10, 1}},
        decoder: Decoder,
        converter: %Membrane.FramerateConverter{framerate: {2, 1}},
        encoder: Encoder,
        sink: %Sink{location: "output.h264"}

      links = [
        |> to(:parser)
        |> to(:decoder)
        |> to(:converter)
        |> to(:encoder)
        |> to(:sink)
    {{:ok, spec: %ParentSpec{children: children, links: links}}, %{}}

## Copyright and License

Copyright 2020, [Software Mansion](

[![Software Mansion](](

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