...
Code Block | ||||
---|---|---|---|---|
| ||||
vod://sample.mp4 |
where sample.mp4 - is the name of the file that should be located in /usr/local/FlashphonerWebCallServer/media folder. Since build 5.2.687, a custom folder can specified with the following parameter in flashphoner.properties file
Code Block | ||
---|---|---|
| ||
media_dir=/usr/local/FlashphonerWebCallServer/media |
...
If a file with such a name does not exist, the server returns the StreamStatusEvent FAILED message, where the "info" field has the reason: "File not found".
A stream created this way can be displayed to one user (personal VOD). Second viewer cannot subscribe to personal VOD stream, such stream cannot be transcoded, added to mixer or played by HLS.
If a full-featured online-broadcast is required, provide the link to a file as follows:
...
Multiple user can connect to such a stream simultaneously. VOD live stream can be transcoded, added to mixer or played by HLS.
Supported formats and codecs
...
- The browser connects to the server via Websocket WebSocket and sends the publish command.
- The browser captures the microphone and the camera and sends the WebRTC stream as H.264 + AAC to the server, enabling recording with the parameter record: true.
- The WCS server records the stream to a file.
- The browser stops publishing.
- The second browser establishes a connection via WebsocketWebSocket, creates a stream, specifies the file name, and sends the play command.
- The second browser receives the WebRTC stream and plays this stream on the page.
...
Code Block | ||
---|---|---|
| ||
vod_live_loop=true |
VOD capturing from AWS S3 or from other S3 compatible storage
VOD stream can be captured from file placed to AWS S3 storage. Comparing with VOD capture from local disk, file from external storage is downloaded and captured sequentally.
...
- bucket is S3 bucket name
- sample.mp4 is file name
Operation flowchart
1. Browser requests VOD capture from AWS file
2. WCS server sends request to AWS
3. File is downloaded to WCS server
4. WebRTC stream from file is sending to browser for playback
Set up
To download files from AWS S3 bucket, S3 credentials must be set in flashphoner.properties fileSince build 5.2.939 it is possible to set the full file URL in S3 storage, this allows to capture VOD from other S3 storages (Digital Ocean, Selectel etc)
Digital Ocean Spaces URL example
Code Block | ||
---|---|---|
| ||
aws_s3_credentials=zone;login;hash |
...
vod://s3/https://ams3.digitaloceanspaces.com/myspace/folder/file.mp4 |
Selectel URL example
Code Block | ||
---|---|---|
| ||
vod_mp4_container_new=true |
File format requirements
...
://s3/https://s3.selcdn.ru/mystorage/file.mp4 |
Operation flowchart
1. Browser requests VOD capture from AWS file
2. WCS server sends request to AWS
3. File is downloaded to WCS server
4. WebRTC stream from file is sending to browser for playback
Set up
S3 credentials configuration
AWS
To download files from AWS S3 bucket, S3 credentials must be set in flashphoner.properties file
Code Block | ||
---|---|---|
| ||
aws_s3_credentials=zone;login;hash |
Where
- zone - AWS region where bucket is placed
- login - Access Key ID
- hash - Secret Accesss Key
S3 credentials setting example:
Code Block | ||
---|---|---|
| ||
aws_s3_credentials=eu-central-1;AA22BB33CC44DE;DhlAkpZ4adclHhbLwhTNL4hvWTo80Njo |
Digital Ocean Spaces
To download files from DO Spaces set the credentials as
Code Block | ||
---|---|---|
| ||
aws_s3_credentials=ams3;access_key;secret |
Where
- ams3 - digitaloceanspaces.com subdomain
- access_key - storage access key
- secret - storage access secret code
Selectel
To download files from Selectel S3 set the credentials as
Code Block | ||
---|---|---|
| ||
aws_s3_credentials=ru-1a;login;password |
Where
- ru-1a - storage region
- login - user name
- password - password
Capturing VOD stream from file while it is downloading
To capture stream from file while it is downloading, the following parameter should be set
Code Block | ||
---|---|---|
| ||
vod_mp4_container_new=true |
If channel bandwidth between WCS and S3 storage is low, or this channel is not stable enough, file bufferization may be enabled. The buffer size is set in milliseconds with the following parameter
Code Block | ||
---|---|---|
| ||
vod_mp4_container_new_buffer_ms=10000 |
In this case, buffer size is 10 seconds.
File format requirements
Header section (moov) should always be before data section (mdat). File structure should be like this:
Code Block | ||
---|---|---|
| ||
Atom ftyp @ 0 of size: 32, ends @ 32 Atom moov @ 32 of size: 357961, ends @ 357993 ... Atom free @ 357993 of size: 8, ends @ 358001 Atom mdat @ 358001 of size: 212741950, ends @ 213099951 |
...
Code Block | ||||
---|---|---|---|---|
| ||||
AtomicParsley file.mp4 -T 1 |
Wrong file structure can be fixed if necessary with ffmpeg without reencoding
Code Block | ||||
---|---|---|---|---|
| ||||
ffmpeg -i bad.mp4 -acodec copy -vcodec copy -movflags +faststart good.mp4AtomicParsley file.mp4 -T 1 |
If the file structure does not match the requiremets, this file will not be played. Wrong file structure can be fixed if necessary with ffmpeg without reencoding
Code Block | ||||
---|---|---|---|---|
| ||||
ffmpeg -i bad.mp4 -acodec copy -vcodec copy -movflags +faststart good.mp4 |
File name requirements
Official AWS S3 documentation does not recommend to use spaces along another special characters, but does not prohibits them. If the file name contains spaces, they should be replaced by '%20', for example
Code Block | ||
---|---|---|
| ||
vod://s3/bucket/sample%20with%20spaces.mp4 |
VOD capture management with REST API
...
REST queries and responses
REST query | REST query example | REST response example | Response states | Description | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
/vod/startup |
| 409 - Conflict 500 - Internal error | Capture VOD stream from file | ||||||||
/vod/find |
|
|
| 200 – OK 404 – not found | Find VOD streams by criteria | ||||||||
/vod/find_all |
|
|
|
|
|
|
| 200 – OK 404 – not found | Find all |
/vod/terminate
language | js |
---|---|
theme | RDark |
VOD streams | |||||||||||
/vod/terminate |
| 200 - Stream is stopped 404 - Stream not found | Stop VOD stream |
Parameters
Name | Description | Example |
---|---|---|
uri | File name to capture | vod://sample.mp4 |
200 - Stream is stopped
404 - Stream not found
Stop VOD stream
Parameters
Name
Description
Example
uri
File name to capture
localStreamName | Stream name | test |
status | Stream status | PROCESSED_LOCAL |
localMediaSessionId | Mediasession Id | 29ec3236-1093-42bb-88d6-d4ac37af3ac0 |
hasAudio | Stream has audio | true |
hasVideo | Stream has video | true |
record | Stream is recording | false |
loop | VOD is looped | false |
VOD looping on demand
Since build 5.2.1528 it is possible to enable VOD looping while creating VOD live translation via REST API
Code Block | ||||
---|---|---|---|---|
| ||||
{ "uri":"vod-live://sample.mp4 |
...
test
...
status
...
Stream status
...
PROCESSED_LOCAL
...
29ec3236-1093-42bb-88d6-d4ac37af3ac0
...
true
...
true
...
",
"localStreamName": "test",
"loop": true
} |
By default, if loop
parameter is not set, vod_live_loop
is applied. If the parameter is set, its value is applied as follows
true
- file will be loopedfalse
- file will be played once, then VOD live translation will stop
The loop
parameter has a precedence over vod_live_loop
value.
Known limits
/rest-api/vod/startup
query can be used for VOD live translations creation only. However, find,
find `find_all and `and terminate
queries can be applied both to VOD and VOD live translations.
...