ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.35k stars 5.33k forks source link

Will SRS support controlling recording files through the interface? #3510

Closed linkewei0580 closed 1 year ago

linkewei0580 commented 1 year ago

Will SRS support controlling the recording file through the API interface? This is supported in NGINX-RTMP, so it would be great if we can record when needed. Thank you.

TRANS_BY_GPT3

linkewei0580 commented 1 year ago

RAW API implementation is about how to modify the configuration and reload it. The most natural way is to write a backend server using Go or Node.js. After modifying the configuration file, you can send a signal to SRS or call the reload API. Moreover, how to modify the configuration and when to modify it are strongly related to the business, and they are part of the business system. Therefore, they were removed in version 4.0.

RAW API is removed because it implements the config file modify and reload, which should do by user server.

HTTP RAW API is an experimental capability introduced in version 3.0.

[Experimental] Support HTTP RAW API, please read https://github.com/ossrs/srs/issues/459 https://github.com/ossrs/srs/issues/319 It mainly provides the ability to modify the system's API, primarily through modifying configuration files and then reloading them to take effect. After providing this capability, there have been continuous bug reports and issues related to it, so it has been decided to remove this experimental capability in version 4.0.

The main reason for its numerous issues is that the business system, which should have been implemented by the users, was instead implemented within the RAW API. For example, on-demand recording only requires recording certain streams.

A typical approach is to create a separate system to manage FFmpeg processes, where each FFmpeg pulls streams for recording and uses HTTP callbacks to determine which streams need to be recorded.

Alternatively, HLS can be used to write ts files, and the on_hls callback can be used to decide which streams need to be recorded.

On the other hand, modifying dvr_apply in the RAW API allows enabling recording on certain streams.

Using the RAW API triggers numerous boundary conditions, such as streams being pushed and then stopped, and the recording rules can be highly diversified. These are typical considerations that a recording service needs to take into account, as each recording may have different requirements, rather than being suitable for implementation in a general open-source solution.

TRANS_BY_GPT3