Skip to main content

FAQ

Note: This is FAQ for SRS Stack, please see SRS FAQ for SRS FAQ.

Quick Content

You can also search for keywords on the page.




Video Guides

The following are video materials for answering questions, which explain a certain topic in detail. If your question is similar, please watch the video directly:




How to get started

Please purchase and set up SRS Stack Server first.

After entering the SRS Stack Server, there will be corresponding video tutorials according to different application scenarios, as shown in the following figure:

Each scenario also has a complete introduction and detailed operation steps, as shown in the following figure:

Please do not try randomly, be sure to follow the guide, audio and video random testing will definitely cause problems.




How to upgrade

How to upgrade to the latest version or stable version, and why not support click upgrade on the interface?

Since SRS Stack supports multiple platforms, including Docker, and Docker cannot upgrade itself, SRS Stack also does not support interface upgrades and needs to be upgraded manually.

If you use HELM, and get srs-stack 1.0.1 installed, then you can upgrade by helm upgrade srs srs/srs-stack --version 1.0.2 and helm rollback srs if want to rollback to 1.0.1.

The Docker startup specifies the version, such as ossrs/srs-stack:v1.0.293, and you only need to delete the container and start with the new version, such as ossrs/srs-stack:v1.0.299.

If you use ossrs/srs-stack:1, it is the latest version, and you need to update manually, such as docker pull ossrs/srs-stack:1.

If you use aaPanel panel, just delete the application and reinstall the new version, the data is saved in the /data directory and will not be lost.




How to set a domain

How to set up a domain to access the admin panel, why can't the admin panel be opened, and why can't the admin panel be accessed via IP.

Please replace the following domain names and IPs with your own domain names and IPs, which can be either private or public IPs, as long as your browser can access them.

When installing SRS Stack with aaPanel, you need to enter the domain name of the management backend, such as bt.yourdomain.com, and it will automatically create the management backend website.

Note: When installing with aaPanel, if you want to use IP access, you can set it to bt.yourdomain.com, and then set the srs.stack.local website as the default website in aaPanel.

If you install it in other ways, it's the same. You just need to resolve your domain name to the SRS Stack IP.

There are several ways to set up domain name resolution:

  1. DNS domain name resolution: In the backend of your domain name provider, set an A record pointing to the SRS Stack IP.
A bt.yourdomain.com 121.13.75.20
  1. Modify the local /etc/hosts file in Linux/Unix to resolve the domain name to the SRS Stack IP.
121.13.75.20 bt.yourdomain.com
  1. Modify the local C:\Windows\System32\drivers\etc file in Windows to resolve the domain name to the SRS Stack IP.
121.13.75.20 bt.yourdomain.com

Note: If you need to apply for a free HTTPS certificate through Let's Encrypt, the IP address must be a public IP, and you cannot use the method of modifying the hosts file.




Supported platforms

SRS Stack supports Docker images, installation scripts, DigitalOcean images, and can be installed on other platforms using aaPanel.

It is recommended to install directly using Docker, which also allows for multiple installations. Be sure to use Ubuntu 20+ system:

  • Docker image installation: here

If you are used to aaPanel, you can install it with aaPanel, which can coexist with multiple websites. Be sure to use Ubuntu 20+ system:

It supports various cloud platforms, and the most convenient method is using images, which are cloud server images. If you want to keep it simple and save time, please use images:

If you find that some features are missing, it may be because the version you chose is older. According to the update speed of features:

Docker/Script > aaPanel > DigitalOcean

If you consider convenience and simplicity, the recommended order is:

DigitalOcean > aaPanel > Docker/Script

You can choose the platform and installation method according to your situation.




How to push multiple streams

By default, there is only one push stream address. What if you want to push multiple streams? How to change the stream address?

You can change the stream name, for example, the default push stream address is:

  • rtmp://1.2.3.4/live/livestream?secret=xxx

You can modify livestream to any other name, and then push directly:

  • rtmp://1.2.3.4/live/any?secret=xxx
  • rtmp://1.2.3.4/live/stream?secret=xxx
  • rtmp://1.2.3.4/live/you?secret=xxx
  • rtmp://1.2.3.4/live/want?secret=xxx

As shown in the figure below, you can click the update button to automatically change the push stream and playback name:

Note: Of course, the playback must also be changed to the corresponding stream name.




How to run multiple instances

The machine has a lot of CPU, how can we support more platform forwarding, or more streams and recording, etc.

You can choose to use Docker to start SRS Stack, which makes it very easy to run many isolated SRS Stack instances that don't affect each other and utilize the machine resources.

For example, start two instances listening on ports 2022 and 2023, and use different ports for streaming media:

docker run --rm -it -p 2022:2022 -p 1935:1935 \
-p 8000:8000/udp -p 10080:10080/udp --name srs-stack \
-v $HOME/data0:/data ossrs/srs-stack:5

Then, open http://localhost:2022 to log in to the backend.

docker run --rm -it -p 2023:2022 -p 1936:1935 \
-p 8001:8000/udp -p 10081:10080/udp --name srs-stack1 \
-v $HOME/data1:/data ossrs/srs-stack:5

Then, open http://localhost:2023 to log in to the backend.

Note: Be careful not to use duplicate ports and make sure the mounted data directories are unique. Keep the two SRS Stacks completely separate.

Although the SRS Stack web UI doesn't display the RTMP port because it uses the same port 1935 within the docker, this doesn't cause any issues. You can still publish to each stack using different RTMP ports. However, you can setup the exposed ports:

docker run --rm -it -p 2023:2022 -p 1936:1935 \
-p 8001:8000/udp -p 10081:10080/udp --name srs-stack1 \
-e HTTP_PORT=2023 -e RTMP_PORT=1936 -e RTC_PORT=8001 -e SRT_PORT=10081 \
-v $HOME/data1:/data ossrs/srs-stack:5

If you only need multi-platform streaming or virtual streaming without involving the push stream port, you can use it directly.

If you need to push streams to two SRS Stack instances, you need to specify the ports, such as pushing streams to these two SRS Stacks:

  • rtmp://ip:1935/live/livestream
  • rtmp://ip:1936/live/livestream

Other protocol ports should also be changed accordingly, such as HLS:

  • http://ip:2022/live/livestream.m3u8
  • http://ip:2023/live/livestream.m3u8

Of course, this doesn't mean you can start thousands of SRS Stacks. You should pay attention to your CPU and memory, as well as whether your machine has enough bandwidth.




Low bandwidth, get more bandwidth

The bandwidth of lightweight application servers ranges from 4 to 20Mbps, which is somewhat limited for audio and video. If you want higher bandwidth, such as 100Mbps, you can choose CVM or AWS VPS.

Note: The usage of SRS Stack is consistent, but the purchase and platform configuration are different.

The advantages of CVM cloud servers are:

  • The bandwidth can be up to 100Mbps, and multiple platforms can be used to forward to other CVM servers. Ten CVMs can achieve 1Gbps bandwidth, but of course, you have to consider your budget.
  • Pay-as-you-go, you can stop the machine at any time without charge, and use it again when needed. It is more friendly for low-frequency application scenarios.

The disadvantages of CVM cloud servers are:

  • High cost, no free traffic package. Lightweight servers have low cost, and the free traffic package is basically enough for general live streaming. So please calculate the cost yourself.
  • Complex operation, CVM's security group is much more complicated than the lightweight firewall operation. Please try it yourself. If it doesn't work, switch to lightweight.
  • No background link, the interface is more complex. If it doesn't work, switch to lightweight.

If you still want to choose CVM after knowing the advantages and disadvantages, please refer to SRS Stack: Support CVM image.




How to set up free HTTPS

SRS Stack supports applying for free HTTPS certificates, and you can apply for certificates for multiple domain names and automatically renew them. For example, the certificates for the following HTTPS websites are all automatically applied after running SRS Stack:

The operation is very simple, just follow these three steps, please see here:

  1. Purchase a domain name and complete the filing. You must have your own legal domain name, otherwise, you cannot apply for a certificate.
  2. Resolve the domain name to the public IP of SRS Stack. You can add multiple domain names to resolve, for example, ossrs.io and www.ossrs.io are both resolved to the same SRS Stack server.
  3. In SRS Stack's System Settings > HTTPS > Automatic HTTPS Certificate, fill in your domain name, separate multiple domain names with semicolons, and click Apply.

Note: Just apply for the domain name, do not upload it again. Once applied, you don't need to upload it again.

Note: If you're using aaPanel to install SRS Stack, you can choose to apply through aaPanel or apply within SRS Stack.

If you encounter an error while applying and the message says Could not obtain certificates: error: one or more domains had a problem, the possible reasons are:

  • The domain is not pointing to the SRS Stack's IP. You must use DNS to point the domain to the SRS Stack's IP, instead of setting it in the hosts file.
  • The IP of the SRS Stack must be publicly accessible, meaning it should be an IP that anyone on the internet can access, not just within a private network.
  • The port must be 80, not 2022, because Let's Encrypt will verify your domain in reverse and access it through port 80.

If use docker to start SRS Stack, you can add port mapping for 80 and 443:

docker run --rm -it --name srs-stack -v $HOME/data:/data \
-p 2022:2022 -p 2443:2443 -p 1935:1935 -p 8000:8000/udp -p 10080:10080/udp \
-p 80:2022 -p 443:2443 \
ossrs/srs-stack:5

After the application is successful, enter https plus your domain name in the browser, and you can access your website.




How to use server file for virtual live events

How to upload file to server and use it in virtual live events.

You can use other tools like FTP or SCP to upload large files to the server, and then use these uploaded files in Virtual Live Events. However, it's required that the uploaded files be located in the /data directory.

SRS Stack runs inside a container, so the /data path mentioned refers to a directory within the container. You can map a directory from your host machine to the /data directory inside the container. For example, by using docker run -v /your-host-dir:/data/my-upload, you can access the /data/my-upload directory inside the container.

Then, when you upload a file to your host directory, such as my-file.mp4, the file in the host is /your-host-dir/my-file.mp4, you can access it within SRS Stack by specifying /data/my-upload/my-file.mp4.

After uploading files, you can also enter the SRS Stack container to check if the files are present. For example, you can execute the command:

docker exec -it srs-stack ls -lh /data/my-upload/my-file.mp4

If it indicates that the file exists, you can use this file in SRS Stack's Virtual Live Events. If not, please check whether the path was mapped correctly when starting Docker.




How to modify the push authentication key

If you need to update the push authentication key or change the push key, you can follow these steps:

  1. Enter the System Settings panel.
  2. Select the Stream Authentication tab.
  3. Enter the new stream key.
  4. Click the Update button.
  5. Refresh the pages of each scene, and the push key will be automatically updated.

As shown in the picture below:

If you need to disable push authentication, please refer to the instructions below.




How to disable push authentication

In the scene page, the standard push format is with ?secret=xxx authentication, such as rtmp://ip/live/livestream?secret=xxx

It is found that some cameras do not support the ?secret=xxx format, so the address is not supported.

In this case, you can actually put the key xxx directly in the stream name, such as: rtmp://ip/live/livestreamsecretxxx, and there will be no problem.

Of course, if you only need to push one stream, you can directly use the key as the stream name, such as: rtmp://ip/live/xxx.

Note: Of course, the playback must also be changed to the same stream name, and the key must be included, because the key is placed in the stream name here, so the playback must also be changed.

This way, there is security, and it can support devices that do not support special characters. In addition, the push key can be changed, so you can change it to the way you want.




How to record to local disk

How to record to the local disk of SRS Stack? After upgrading to v1.0.252, you can see local recording in the recording.

For the limitations and solutions of local recording, please refer to #42




Difference between cloud recording and cloud on-demand

SRS Stack provides two similar functions, cloud recording and cloud on-demand. What is the difference between using cloud recording or cloud on-demand for recording?

Cloud recording can be considered as writing live streaming to the cloud disk, saving it in HLS format, which is the original video stream. If you want to download HLS for transcoding and editing, it would be more suitable. Cloud recording is stored in Tencent Cloud COS cloud storage, which can be considered as an unlimited disk, avoiding overwriting the disk of SRS Stack.

Cloud on-demand provides both HLS and MP4 formats, and more features will be added in the future, such as outputting multiple bit rates, adding logos and watermarks, media asset management, and many other useful features. Cloud on-demand is a video-on-demand system, not just a storage disk. It can be considered as a Bilibili or YouTube. If you want to do more diverse businesses, you must choose cloud on-demand.

In terms of cost, cloud on-demand will be slightly higher than cloud recording, depending on which features are used. Currently, SRS Stack uses HLS to MP4 conversion, which is very low in cost because there is no transcoding. In the future, if you want to use advanced features, the cost will be higher. Overall, the cost of cloud on-demand is very low, similar to cloud recording. If there is no additional computing cost, it will be the same as cloud recording.

In short, it is recommended to use cloud on-demand, which is easy to use and not expensive.




How to record to cloud storage

SRS Stack supports recording to COS, Tencent Cloud Storage. Please refer to Usage: Cloud Storage.

SRS Stack can also record to other cloud storage, such as Alibaba Cloud OSS or AWS S3. According to the guidance of cloud storage, mount the cloud storage to SRS Stack, and then use local recording, configure the local storage path, so that you can write files to cloud storage.

Note: To modify the local recording path, you can go to Local Recording/Recording Folder, and soft link the recording path to the cloud storage path.




Unable to access after installation

In the new version of the aaPanel plugin, to avoid conflicts with existing website settings, it no longer automatically sets itself as the default website. Instead, you need to specify a domain or manually set the default website. Please refer to How to Set a Domain.

After installation, an error is prompted, such as:

Or Redis is not ready, such as:

This is because it takes time for SRS Stack to start after installation. Refresh the page after waiting for 3 to 5 minutes.




Difference between SRS Restream and OBS Restream

SRS's multi-platform restreaming can push the stream to multiple platforms, and its working diagram is as follows:

OBS/FFmpeg --RTMP--> SRS Stack --RTMP--> Video number, Bilibili, Kuaishou, and other live streaming platforms

In fact, OBS also has a restreaming plugin, and its working diagram is as follows:

OBS --RTMP--> Video number, Bilibili, Kuaishou, and other live streaming platforms

It seems that OBS's link is shorter and simpler, and it doesn't need to go through SRS Stack or pay money. So why does SRS Stack still need to do restreaming, and what are the drawbacks of OBS's solution?

The advantage of OBS restreaming is that it doesn't cost money and can be restreamed directly. The disadvantage is that its uplink/upload bandwidth is doubled. For example, a 2Mbps stream, if restreamed to 3 platforms, will be 6Mbps. If more video numbers need to be pushed, it will be even more, such as pushing to 10 platforms, which will be 20Mbps.

Higher bandwidth will cause all push streams to stutter or interrupt, making it impossible for all viewers to watch the live broadcast, resulting in a live broadcast accident. As long as there is a rollover once, most of the people in the live broadcast room will run away, which is a very serious accident.

Basically, 80% of live broadcast rollovers are caused by problems with the anchor's push stream. Because the problems of cloud platforms and viewer viewing have been almost solved, the only unsolvable problem is the anchor's push stream.

If you have a dedicated fiber-optic line at home, such as buying a 100Mbps dedicated line, there will be no problem. The problem is that a 100Mbps dedicated line is very expensive, and even if it is temporarily free, there will be a day when it will be charged because a dedicated line is a dedicated resource and cannot be free forever. It's like someone giving you gold bars for free, how long can it be free?

SRS Stack also has doubled bandwidth, but it is the downstream bandwidth that is doubled because it has done a conversion, and essentially other platforms are downloading the stream from SRS Stack. Downstream/download bandwidth is generally more guaranteed. Moreover, between SRS Stack and the platform, they are all BGP bandwidth between servers, which is more guaranteed in quality than the home-to-platform connection.




How SRS Restreams to Custom Platforms

SRS's multi-platform restreaming can push to custom live streaming platforms, such as pushing to the video number's push stream address and stream key, and can also fill in any other live streaming platform.

Note: The reason why SRS Stack is divided into video numbers and platforms like Bilibili is to provide better guidance. The RTMP address format of these platforms is similar, so you can fill in any platform, and SRS Stack will not verify the specific platform.

If the RTMP address of the live streaming platform is a single address, such as:

rtmp://ip/app/stream

Then, you can split it into:

  • Push stream address: rtmp://ip/app
  • Stream key: stream

Note: The part after the last slash is the stream key.




How to Replace FFmpeg

If you are using the Docker version, you can replace the FFmpeg in SRS Stack with a custom version by specifying the command at startup:

-v /path/to/ffmpeg:/usr/local/bin/ffmpeg

You can use the command which ffmpeg to find the path of your FFmpeg.

Note: Non-Docker versions are not supported.




Baota Installation of SRS is Very Slow

Some users have reported that overseas Baota installations are very slow, and accessing Alibaba Cloud's mirror is too slow.

This is because Baota cannot be used overseas. Installing other tools with Baota overseas is also very slow because downloading data across countries back to China is naturally very slow.

The overseas version of Baota is called aaPanel. Please use aaPanel, which installs software quickly, and SRS Stack will also switch to overseas mirror downloads.

Baota and aaPanel only have different installation methods, but the specific usage is the same. Please refer to Baota or aaPanel.




How to Install the Latest SRS Stack on Baota

Sometimes the version in the Baota store is older, and you can manually install the Baota plugin to install the latest plugin.

The latest version of SRS Stack can be found in Releases, and the aapanel-srs_stack.zip attachment in each version can be downloaded as a plugin.

After downloading the plugin, you can go to Baota Software Store > Third-Party Applications > Import Plugin and upload the downloaded aapanel-srs_stack.zip to install.




aaPanel CentOS7 Installation Failure

Note: Ubuntu 20 (Focal) is highly recommend, please don't use CentOS.

Common errors for CentOS7 aaPanel installation failure are:

  • GLIBC version issue: version `GLIBC_2.27' not found
  • Directory not found: ln: failed to access '/www/server/nvm/versions/node/v18.12.1/bin/node'

These are all due to problems with nodejs on CentOS7. Generally, after installing pm2, nodejs18 is installed, which depends on a higher version of libc, so it cannot be used.

Solution:

Note: SRS Stack v4.6.3+ no longer requires pm2 to install nodejs. As long as the system has nodejs, it can be used. You can choose to install it with the nodejs manager, or with pm2, or you can install it yourself.

Finally, if it is still not available after successful installation, you can try restarting the system.




How to implement the proposed features and how to record videos

Welcome everyone to submit questions and new features to SRS Stack, but please explain the real business.

Most friends don't know what real business is, and generally describe the implementation plan of the business. However, this plan may not be the most suitable, and there may even be other technical solutions that can achieve this business goal. Therefore, please describe the business instead of describing the technical implementation of the function or plan.

Please describe the business scenario in detail and try to answer the following questions:

  1. What kind of business are you in? As an ordinary person, how can I use your products and services? Please give a real example.
  2. What problems are you solving in your business with SRS? Please give a real example.
  3. How is the demand or function you proposed for SRS applied in the business? Please give an example.

Note: If it is inconvenient to talk in the group, you can send it to me privately on WeChat.

The SRS Stack server open-source community works like this: you submit application scenarios, and we will prioritize implementation, using real nails to choose hammers, and welcome everyone to participate.




Unable to achieve the desired effect

If the expected effect is not achieved, such as high latency or failure to push and pull streams, the following methods can solve all problems:

Don't change a word, follow the video tutorial and application scenario guidance, mouse operation 
copy and paste, it will definitely work well!

Because the only reason everyone has problems is that they think audio and video are simple and make random changes!




The difference between SRS Stack and SRS

SRS is an open-source server, a streaming media server, which generally works with FFmpeg and WebRTC clients to achieve audio and video capabilities. Please see this diagram to understand what SRS is.

SRS Stack is an audio and video solution that is based on SRS, Nodejs, REACT, etc. to implement common audio and video scenarios. Please see this diagram to understand what SRS Stack is.

After SRS is installed, it opens a streaming media server demo page with links to the player and console; after SRS Stack is installed, it opens a login management backend that provides guidance for many different scenarios.

If you need to study the streaming media server in detail, please follow the SRS documentation and join the SRS community, and do not ask in the SRS Stack group. SRS is an open-source audio and video server, aimed at highly skilled C/C++ programmers, and you can modify it at will, with strong customization capabilities.

If you want an out-of-the-box audio and video platform that can be used online, please use SRS Stack and do not ask in the SRS community. The meaning of SRS Stack is SRS in the cloud. It is a cloud-based service aimed at users who do not need to understand the details of audio and video and can operate according to the tutorial.

Both are open-source projects, and contributions are welcome.




The difference with aaPanel

aaPanel is a virtual machine management tool, and SRS Stack Server is an out-of-the-box audio and video solution. aaPanel can also install SRS Stack, please refer to supported platforms.

Note: The overseas version of Baota is called aaPanel, which also supports SRS Stack; if your machine is overseas, please do not use Baota, but use aaPanel; everyone uses different installation sources, and using Baota overseas may be very slow or even fail.




The difference with Video Cloud

Video Cloud is a large-scale service scenario, such as cloud live broadcasting, TRTC, IM, cloud on-demand, CDN, Tencent Meeting or ZOOM, which are all super-large-scale systems.

SRS Stack Server puts all these systems in a single Lighthouse/CVM/Droplet/aaPanel cloud server, so it is mainly comprehensive, but the concurrency and scale are very small, only suitable for small and micro scenarios, quickly building applications to achieve business, understanding and learning new scenarios, and can run and slowly see how to implement.

Of course, in the future, SRS Stack Server will also support migration to mature video cloud services, allowing everyone to quickly meet business requirements while also getting scalable support as the business grows.




How to reinstall the system

If you already have a Lighthouse/CVM/Droplet, or there is a problem with the image, you can reinstall the image to solve it. Do not log in and mess around by yourself, it will only cause more problems, it is better to choose to reinstall the system directly.

Take Lighthouse as an example, other platforms operate similarly. First, in the application management, select Reinstall System:

Then, in the image type, select Application Image, and then select the corresponding SRS image, as shown below:

Finally, click Confirm and OK, and it will be reinstalled very quickly.




How to authorize troubleshooting

How to authorize machine permissions when a problem occurs? It is recommended to use aaPanel:

  1. Panel settings.
  2. Security settings.
  3. Temporary access authorization management.
  4. Create temporary authorization.

Send the temporary authorization address to the troubleshooting classmates.




OpenAPI

Regarding the open API, using AP to dock with SRS Stack, you can follow the guide in System Configuration > OpenAPI.

All operations of SRS Stack are done by calling the API, and these APIs can be seen in the Chrome Network panel for specific requests.

All operations that can be completed on the SRS Stack page can be completed through OpenAPI.




Features

SRS Stack (i.e., SRS Stack Server) is an open-source solution implemented in nodejs, with the code in srs-stack. Everyone is welcome to join.

SRS Stack Server is aimed at mouse programming, allowing everyone to do audio and video business. It is suitable for those who do not understand audio and video, those who understand audio and video, those who farm, those who pull network cables, those who cut movies, those who carry cameras, those who dance, those who sing, those who sell second-hand goods, those who exchange open-source projects, those who live on multiple platforms, those who build their own source stations, those who can use computers and have WeChat, and those who are law-abiding citizens.

For instructions on using SRS Stack, please refer to the video SRS Stack Server: Getting Started, Purchasing, and Introduction.

Currently, the scenarios and functions supported by SRS Stack, see Features.

Welcome to join the group to discuss the use of SRS Stack. All these SRS peripheral services are open-source and can be customized and deployed by yourself.




HTTP Callback

HTTP Callback refers to the SRS Stack running within a Docker container, initiating an HTTP request to a target URL. For instance, the following process illustrates that when OBS publishs an RTMP stream to SRS Stack, the SRS Stack informs your server about the event by sending an HTTP request to the target URL.

                   +-----------------------+
+ +
+-------+ + +-----------+ + +--------------+
+ OBS +--RTMP->--+-----+ SRS Stack +-----+----HTTP--->-----+ Your Server +
+-------+ + +-----------+ + (Target URL) +--------------+
+ +
+ Docker +
+-----------------------+

All HTTP requests should be:

  • Content-Type: application-json

All responses should use:

  • Status: 200 OK and {"code": 0} for success.
  • Otherwise, error or fail.

See examples in HTTP Callback

HTTP Callback: Connectivity Check

Occasionally, you might need to verify if the network is accessible and determine the appropriate target URL to use. By using the curl command inside the Docker container, you can simulate this request and confirm if the target URL can be accessed by curl or the SRS Stack.

First, install curl in SRS Stack:

docker exec -it srs-stack apt-get update -y
docker exec -it srs-stack apt-get install -y curl

Then, simulate an HTTP request to your server:

docker exec -it srs-stack curl http://your-target-URL

You can use any target URL to test, such as:

  • Intranet IP: http://192.168.1.10/check
  • Internet IP: http://159.133.96.20/check
  • URL via HTTP: http://your-domain.com/check
  • URL via HTTPS: https://your-domain.com/check

Keep in mind that you should test the connection to the target URL within the SRS Stack Docker, and avoid running the curl command from a different server.

HTTP Callback: on_publish

For HTTP callback on_publish event:

Request:
{
"request_id": "b8ffdd76-e1a9-43c8-b238-4649aef76d77",
"action": "on_unpublish",
"opaque": "mytoken",
"vhost": "__defaultVhost__",
"app": "live",
"stream": "livestream",
"param": "?secret=8f7605d657c74d69b6b48f532c469bc9"
}

Response:
{
"code": 0
}
  • Allow publishing if response success.
  • Reject publishing if response error.

HTTP Callback: on_unpublish

For HTTP callback on_unpublish event:

Request:
{
"request_id": "b8ffdd76-e1a9-43c8-b238-4649aef76d77",
"action": "on_unpublish",
"opaque": "mytoken",
"vhost": "__defaultVhost__",
"app": "live",
"stream": "livestream"
}

Response:
{
"code": 0
}
  • Ignore any response error.

HTTP Callback: on_record_begin

For HTTP callback on_record_begin event:

Request:
{
"request_id": "b8ffdd76-e1a9-43c8-b238-4649aef76d77",
"action": "on_record_begin",
"opaque": "mytoken",
"vhost": "__defaultVhost__",
"app": "live",
"stream": "livestream",
"uuid": "824b96f9-8d51-4046-ba1e-a9aec7d57c95"
}

Response:
{
"code": 0
}
  • Ignore any response error.

HTTP Callback: on_record_end

For HTTP callback on_record_end event:

Request:
{
"request_id": "b8ffdd76-e1a9-43c8-b238-4649aef76d77",
"action": "on_record_end",
"opaque": "mytoken",
"vhost": "__defaultVhost__",
"app": "live",
"stream": "livestream",
"uuid": "824b96f9-8d51-4046-ba1e-a9aec7d57c95",
"artifact_code": 0,
"artifact_path": "/data/record/824b96f9-8d51-4046-ba1e-a9aec7d57c95/index.mp4",
"artifact_url": "http://localhost:2022/terraform/v1/hooks/record/hls/824b96f9-8d51-4046-ba1e-a9aec7d57c95/index.mp4"
}

Response:
{
"code": 0
}
  • The uuid is the UUID of record task.
  • The artifact_code indicates the error code. If no error, it's 0.
  • The artifact_path is the path of artifact mp4 in the container.
  • The artifact_url is the URL path to access the artifact mp4.
  • Ignore any response error.



Changelog

Migrated to CHANGELOG.md.