Skip to content

Commit

Permalink
Refactor input information and add docs about mp4s (#393)
Browse files Browse the repository at this point in the history
Co-authored-by: Wojciech Kozyra <[email protected]>
  • Loading branch information
jerzywilczek and wkozyra95 authored Feb 19, 2024
1 parent e297993 commit 635622a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 56 deletions.
11 changes: 11 additions & 0 deletions docs/pages/api/inputs/mp4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Docs from "@site/pages/api/generated/renderer-Mp4.md"

# MP4
An input type that allows the compositor to read static MP4 files.

Mp4 files can contain video and audio tracks encoded with various codecs.
This input type supports mp4 video tracks encoded with h264 and audio tracks encoded with AAC.

If the file contains multiple video or audio tracks, the first audio track and the first video track will be used and the other ones will be ignored.

<Docs />
6 changes: 6 additions & 0 deletions docs/pages/api/inputs/rtp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Docs from "@site/pages/api/generated/renderer-RtpInputStream.md"

# RTP
An input type that allows streaming video and audio to the compositor over RTP.

<Docs />
62 changes: 6 additions & 56 deletions docs/pages/api/routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,64 +43,14 @@ type UpdateScene = {
```typescript
type RegisterInputStream = {
type: "register";
entity_type: "rtp_input_stream";
input_id: string;
port: Port;
video?: Video;
audio?: Audio;
entity_type: "rtp_input_stream" | "mp4";
... // input specific options
}
```
See inputs documentation to learn more.
Parameters of registered RTP input stream. Before using input in video composition or output mixing, input has to be firstly registered using `register_input` request.
At least one of `video` and `audio` has to be defined.
- `input_id` - An identifier for the input stream.
- `port` - UDP port or port range on which the compositor should listen for the stream.
- `video` - Parameters of a video source included in the RTP stream.
- `audio` - Parameters of an audio source included in the RTP stream.
#### Port
```typescript
type Port = string | u16
```
#### Video
```typescript
type Video = {
codec?: "h264";
rtp_payload_type?: u8;
}
```
- `codec` - (**default=`"h264"`**) Video codec.
- `"h264"` - H264 video.
- `rtp_payload_type` - (**default=`96`**) Value of payload type field in received RTP packets.
Packets with different payload type won't be treated as video and included in composing. Values should be in [0, 64] or [96, 255]. Values in range [65, 95] can't be used. For more information, see [RFC](https://datatracker.ietf.org/doc/html/rfc5761#section-4) Packets with different payload type won't be treated as video and included in composing.
#### Audio
```typescript
type Audio = {
codec?: "opus";
sample_rate: u32;
channels: "mono" | "stereo";
rtp_payload_type?: u8;
forward_error_correction?: bool;
}
```
- `codec` - (**default=`"opus"`**) Audio codec.
- `"opus"` - Opus audio.
- `sample_rate` - Sample rate. If the specified sample rate doesn't match real sample rate, audio won't be mixed properly.
- `channels` - Audio channels.
- `"mono"` - Mono audio (single channel).
- `"stereo"` - Stereo audio (two channels).
- `rtp_payload_type` - (**default=`97`**) Value of payload type field in received RTP packets.
Packets with different payload type won't be treated as audio and included in mixing. Values should be in range [0, 64] or [96, 255]. Values in range [65, 95] can't be used. For more information, check out [RFC](https://datatracker.ietf.org/doc/html/rfc5761#section-4).
- `forward_error_correction` - (**default=`false`**) Specifies whether the stream uses forward error correction. It's specific for Opus codec. For more information, check out [RFC](https://datatracker.ietf.org/doc/html/rfc6716#section-2.1.7).
- [RTP](./inputs/rtp)
- [MP4](./inputs/mp4)
***
Expand All @@ -117,7 +67,7 @@ type RegisterOutputStream = {
width: number;
height: number;
};
encoder_preset?: EncoderPreset;
encoder_preset?: EncoderPreset;
initial_scene: Component
}

Expand Down
7 changes: 7 additions & 0 deletions docs/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ const sidebars: SidebarsConfig = {
description: 'Resources that need to be registered first before they can be used.',
items: ['api/renderers/shader', 'api/renderers/image', 'api/renderers/web'],
},
{
type: 'category',
label: 'Inputs',
collapsible: false,
description: 'Elements that deliver media from external sources.',
items: ['api/inputs/rtp', 'api/inputs/mp4'],
},
],
},
],
Expand Down

0 comments on commit 635622a

Please sign in to comment.