diff --git a/docs/pages/api/inputs/mp4.md b/docs/pages/api/inputs/mp4.md new file mode 100644 index 000000000..d96a131e3 --- /dev/null +++ b/docs/pages/api/inputs/mp4.md @@ -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. + + diff --git a/docs/pages/api/inputs/rtp.md b/docs/pages/api/inputs/rtp.md new file mode 100644 index 000000000..1d1ca821c --- /dev/null +++ b/docs/pages/api/inputs/rtp.md @@ -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. + + diff --git a/docs/pages/api/routes.md b/docs/pages/api/routes.md index 8fa37faac..8545ceee8 100644 --- a/docs/pages/api/routes.md +++ b/docs/pages/api/routes.md @@ -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) *** @@ -117,7 +67,7 @@ type RegisterOutputStream = { width: number; height: number; }; - encoder_preset?: EncoderPreset; + encoder_preset?: EncoderPreset; initial_scene: Component } diff --git a/docs/sidebars.ts b/docs/sidebars.ts index 59be12e10..18b1bd2c3 100644 --- a/docs/sidebars.ts +++ b/docs/sidebars.ts @@ -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'], + }, ], }, ],