# `Membrane.RTMP.Sink`
[🔗](https://github.com/membraneframework/membrane_rtmp_plugin/blob/v0.29.5/lib/membrane_rtmp_plugin/rtmp/sink/sink.ex#L1)

Membrane element being client-side of RTMP streams.
It needs to receive at least one of: video stream in H264 format or audio in AAC format.
Currently it supports only:
  - RTMP proper - "plain" RTMP protocol
  - RTMPS - RTMP over TLS/SSL
other RTMP variants - RTMPT, RTMPE, RTMFP are not supported.
Implementation based on FFmpeg.

## Element options

Passed via struct `t:Membrane.RTMP.Sink.t/0`

- `rtmp_url`  

  ```
  String.t()
  ```
  
  ***Required***  
  Destination URL of the stream. It needs to start with rtmp:// or rtmps:// depending on the protocol variant.
  This URL should be provided by your streaming service.

- `max_attempts`  

  ```
  pos_integer() | :infinity
  ```
  
  Default value: `1`  
  Maximum number of connection attempts before failing with an error.
  The attempts will happen every 500 ms

- `tracks`  

  ```
  [track_type()]
  ```
  
  Default value: `[:audio, :video]`  
  A list of tracks, which will be sent. Can be `:audio`, `:video` or both.

- `reset_timestamps`  

  ```
  boolean()
  ```
  
  Default value: `true`  
  If enabled, this feature adjusts the timing of outgoing FLV packets so that they begin from zero.
  Leaves it untouched otherwise.

## Pads

### `:video`

Accepted formats:
```
%H264{stream_structure: structure} when H264.is_avc(structure)
```

Direction: | `:input`
Availability: | `:on_request`
Flow control: | `:manual`
Demand unit: | `:buffers`

### `:audio`

Accepted formats:
```
AAC
```

Direction: | `:input`
Availability: | `:on_request`
Flow control: | `:manual`
Demand unit: | `:buffers`

# `t`

```elixir
@type t() :: %Membrane.RTMP.Sink{
  max_attempts: pos_integer() | :infinity,
  reset_timestamps: boolean(),
  rtmp_url: String.t(),
  tracks: [track_type()]
}
```

Struct containing options for `Membrane.RTMP.Sink`

# `track_type`

```elixir
@type track_type() :: :audio | :video
```

# `options`

```elixir
@spec options() :: keyword()
```

Returns description of options available for this module

---

*Consult [api-reference.md](api-reference.md) for complete listing*
