...
2. Playback can start slightly earlier if start time is set, depending on closest key frame in the recording file.
Multiple stream recording to one file with subsequent mixing
Since build 5.2.1012 it is possible to record multiple streams to one file. Then streams can be extracted from this file and mixed by a special tool. Multiple streams can be recorded only to MP4 container (H264 + AAC). This feature is intended, for example, to record a video conference. In this case, unlike to MCU mixer, stream mixing works while recording file is post-processed, this allows to aquire a less of server resources during the conference itself.
Multiple stream recording is managed by REST API.
REST query must be HTTP/HTTPS POST query like this:
- HTTP: http://streaming.flashphoner.com:8081/rest-api/multipleRecorder/startup
- HTTPS: https://streaming.flashphoner.com:8444/rest-api/multipleRecorder/startup
Where:
- streaming.flashphoner.com is WCS server address
- 8081 is a standard WCS REST / HTTP port
- 8444 is a standard WCS REST / HTTPS port
- rest-api is mandatory prefix
- /multipleRecorder/startup is REST method
REST methods and responses
REST query | Example of REST query | Example of REST response | Response states | Description | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
/multipleRecorder/startup |
| 409 - Conflict 500 - Internal error | Launch multiple streams recorder | ||||||||
/multipleRecorder/add |
| 404 - Not found 409 - Conflict 500 - Internal error | Add the stream with mediaSessionId to the recorder | ||||||||
/multipleRecorder/find_all |
| 404 - Not found 500 - Internal error | Find all recorders | ||||||||
/multipleRecorder/remove |
| 404 - Not found 500 - Internal error | Remove stream with mediaSessionId from recorder | ||||||||
/multipleRecorder/terminate |
| 404 - Not found 500 - Internal error | Stop multiple streams recorder |
Parametes
Parameter name | Description | Example |
---|---|---|
name | Имя рекордера | test_record |
mediaSessionId | Идентификатор медиасессии потока | 866a9910-fbfe-11eb-aae4-6f99b0c80a3a |
filename | Имя файла, куда производится запись | stream_multiRecorded.mp4 |
Recordinf file name
Multiple streams recording file name is formed by template with suffix _multiRecorded addition. In this case, {startTime}, {endTime} parameters cannot be set because they depend on stream timestamps, and we have a multiple streams with a different timestamps simultaneously. So it is recommended to use {startTimeMillis}, {endTimeMillis} parameters to add servers clock timestamps to file name. For example, with the following template
Code Block | ||||
---|---|---|---|---|
| ||||
stream_record_policy_template={streamName}-{startTime}-{startTimeMillis}-{endTime}-{endTimeMillis} |
file name will look as follows:
Code Block | ||
---|---|---|
| ||
test_record--1-1628821032180--1-1628821151750_multiRecorded.mp4 |
Here {startTime}, {endTime} are replaced by -1.
Multiple streams mixing tool
Only one stream can be played by default from multiple streams recording file. The streams should be mixed to view them all. The OfflineMP4Mixer tool should be used to mix, launching as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
cd /usr/local/FlashphonerWebCallServer/tools
./offline_mixer_tool.sh test_record--1-1628821032180--1-1628821151750_multiRecorded.mp4 |
Offline mixer settings should be defined in /usr/local/FlashphonerWebCallServer/conf/offline_mixer.json file. By default, the following settings are used:
Code Block | ||||
---|---|---|---|---|
| ||||
{
"hasVideo": "true",
"hasAudio": "true",
"mixerDisplayStreamName": true
} |
A mixed file is placed to the same folder as original one, with _mixed suffix addition, for example
Code Block | ||
---|---|---|
| ||
test_record--1-1628821032180--1-1628821151750_multiRecorded_mixed.mp4 |
A picture sample from the mixed file
Multiple recording file handling script
When multiple stream recording is finished, a specila handling script is automatically launched as set by the following parameter
Code Block | ||
---|---|---|
| ||
on_multiple_record_hook_script=on_multiple_record_hook.sh |
By default, script will launch offline_mixer_tool.sh, passing multiple streams reording file name to it.
Known issues
1. Maximum length of file name in all actual Linux file systems is limited to 255 characters. When record file is created, its name will be trimmed to this limit including extension and part number if rotation is enabled.
...