|
| 1 | +***This RFC is dependent on [RFC 39](https://github.com/tytan652/rfcs/blob/service_overhaul/text/0039-service-overhaul.md).*** |
| 2 | + |
| 3 | +# Summary |
| 4 | + |
| 5 | +- Add notion of protocol in service outputs |
| 6 | +- Those outputs are registered with a list of compatible codecs |
| 7 | +- Show only stream encoders compatible with the selected outputs |
| 8 | +- Add as byproduct the possibility to add plugin with new service output with a new protocol (useless without RFC 39) |
| 9 | + |
| 10 | +# Motivation |
| 11 | + |
| 12 | +Create a better management of outputs, encoders and services with a protocol centered approach. |
| 13 | + |
| 14 | +Byproduct: Add also the possibility to support third-party plugin which add protocol support with his own output. |
| 15 | + |
| 16 | +*Services addition is a part of [RFC 39](https://github.com/tytan652/rfcs/blob/service_overhaul/text/0039-service-overhaul.md).* |
| 17 | + |
| 18 | +# Design |
| 19 | +*This RFC does not consider that because a protocol support a encoder it should be implemented in the main project.* |
| 20 | + |
| 21 | +## Outputs API |
| 22 | +**This only concern outputs with the flag `OBS_OUTPUT_SERVICE`.** |
| 23 | + |
| 24 | +Adding to the API those fields: |
| 25 | +- `protocol`: protocols "official" acronym (ex: RTMP, WebRTC) |
| 26 | +- `protocol_prefix` (optional): for custom service detection (eg `rtmp://`, `srt://`) |
| 27 | + |
| 28 | +A output only support one protocol like an encoder support only one codec. |
| 29 | + |
| 30 | +Adding to the API those functions: |
| 31 | +- `bool obs_output_find_protocol(const char*)`: return true if an output with the protocol is registered |
| 32 | +- `const char *obs_output_find_output_with_protocol(const char *)` return an output corresponding to the protocol (the first match if various) |
| 33 | +- a way to enum prefixes and/or a way to find protocol based on the prefix so `obs_output_enum_protocol_prefix` and/or `obs_output_find_protocol_with_prefix` |
| 34 | + |
| 35 | +Those function will be ignore by obs-scripting (Python and Lua). |
| 36 | + |
| 37 | +**This may concern any outputs.** |
| 38 | +Adding to the API those fields: |
| 39 | +- Protocols like SRT are codec agnostic so: |
| 40 | + - `video_codec_agnostic` (boolean, false by default if not set): if true, disable the need of `encoded_video_codecs` |
| 41 | + - `audio_codec_agnostic` (boolean, false by default if not set): if true, this disable the of `encoded_audio_codecs` |
| 42 | + - Or just consider `NULL` as codec agnostic ? |
| 43 | + |
| 44 | +### About Protocols |
| 45 | +`encoded_video_codecs` and `encoded_audio_codecs` shall contain any codec compatible with the protocol following their specification. Except RTMP, it will only support H.264 and AAC for now. |
| 46 | + |
| 47 | +It does not mean that services are compatible with all the codecs present in the specs. And neither mean that OBS support those codecs. |
| 48 | + |
| 49 | +Protocol with variation like RTMP may need to have an output per variation to avoid using RTMPS services if the build of OBS does not support it. |
| 50 | + |
| 51 | +The actually supported protocol with their specification documents : |
| 52 | +- RTMP (https://wwwimages2.adobe.com/content/dam/acom/en/devnet/rtmp/pdf/rtmp_specification_1.0.pdf) |
| 53 | +- RTMPS (same as RTMP) |
| 54 | +- HLS (https://datatracker.ietf.org/doc/html/rfc8216) |
| 55 | +- SRT (https://github.com/Haivision/srt/files/2489142/SRT_Protocol_TechnicalOverview_DRAFT_2018-10-17.pdf ; TLDR: codec agnostic) |
| 56 | +- FTL (no official one found except this https://github.com/microsoft/ftl-sdk/blob/master/README.md) |
| 57 | + |
| 58 | +### Maybe |
| 59 | + |
| 60 | +`encoded_video_codecs` and `encoded_audio_codecs` rather than being string to split, could be replaced an array. |
| 61 | + |
| 62 | +## Services API |
| 63 | +Adding to the API the field `protocol` which match the Outputs API one. |
| 64 | + |
| 65 | +With RFC 39, OBS could prevent showing services where the asked protocol is not in any registered service output. |
| 66 | +And also make services able to not show unsupported protocol if multi-protocol. |
| 67 | + |
| 68 | +We shall consider that if a service handle a protocol, it doens't mean it can handle all the compatible codecs. |
| 69 | +So if a service can't handle all the compatible codec, adding a list of supported codec to a service related to his protocol shall be considered. |
| 70 | + |
| 71 | +Adding to the API those fields: |
| 72 | +- `supported_video_codecs` (optional): sometime stream services don't support all the codec of the specification |
| 73 | +- `supported_audio_codecs` (optional): sometime stream services don't support all the codec of the specification |
| 74 | + |
| 75 | +`rtmp-services` will be modified to obtain this behavior beforehand with only H.264, AAC and Opus as compatible codecs. |
| 76 | + |
| 77 | +## UI |
| 78 | +Changing protocol/output through service change will update the Output page with only compatible encoders. |
| 79 | + |
| 80 | +Compatible encoders are based on what service can handle and if they specify nothing, any codec accepted by the protocol will be shown. |
| 81 | + |
| 82 | +If the service ask for codec not compatible with the protocol, it will be ignored and written in the log as error. |
| 83 | + |
| 84 | +It also may reset encoder settings if the actual encoder was not compatible. |
| 85 | + |
| 86 | +The user may need to be warn about the fact that the encoder was not compatible and he need to setup again his encoder. |
| 87 | + |
| 88 | +## What if there is various registered outputs for one protocol ? |
| 89 | +It could happen that a plugin register a output for a already registered protocol, so we need to manage this possibility. |
| 90 | + |
| 91 | +- Add `preferred_output` to the Services API to use what OBS already provide for some protocols with maybe some hardcode in his getter or maybe hardcode the default output per protocol in the UI. |
| 92 | +- Add `obs_output_find_outputs_with_protocol(const char *)` return all outputs corresponding to the protocol to the Outputs API. |
| 93 | +- Make the user able also to choose an output if various providing the same protocol are registered (e.g FFmpeg SRT and "Native" SRT) as an advanced options. |
| 94 | +- Deprecate `obs_service_get_output_type` because it got replaced. |
| 95 | + |
| 96 | +## Other possible addition |
| 97 | + |
| 98 | +- Make the user able also to choose an audio encoder if various as an advanced options. |
| 99 | + |
| 100 | +## Codec naming |
| 101 | +For codec naming, we try to get the closiest of an official typography even inside a logo. |
| 102 | + |
| 103 | +- H.264/AVC will be named/changed to `H.264` |
| 104 | +- H.265/HEVC will be named `HEVC` since this name is used rather than H.265, only added if adding the fact that a protocol is compatible with it will not cause legal issue. |
| 105 | +- AAC we keep `AAC`. |
| 106 | +- Opus we keep `opus`. |
| 107 | + |
| 108 | +# Benefit |
| 109 | +- FTL, if deprecated by OBS and still used by stream services could be separated in a plugin providing the protocol and the output and also service with [RFC 39 |
| 110 | +](https://github.com/tytan652/rfcs/blob/service_overhaul/text/0039-service-overhaul.md) |
0 commit comments