Live Stream any Custom Video Input
Step 1: Get your API Keys
Login to the Developer Portal and create an account. Copy the API Keys for your organization from the Developer portal. These API Keys are unique to your organization and are required to use Dyte REST APIs such as when instantiating a meeting.
Step 2: Generate credentials for a livestream
This step generates credentials and ingest URLs for the livestream.
curl --location --request POST 'https://api.dyte.io/v2/livestreams' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZGVtbzpwQDU1dzByZA==' \
The response contains the
|ingest_server||The ingest server URL in RTMP livestreaming is the server URL to which the RTMP encoder sends the video and audio data. The ingest server receives the RTMP stream and transcodes it into different video formats and bitrates, which can then be distributed to viewers through a content delivery network (CDN). It is essentially the address of the server where the video data is sent to be processed and distributed for live streaming. You need to enter the |
|id||This is your livestream ID.|
|stream_key||The stream key in RTMP livestreaming is a unique identifier that is used to authorize and link the RTMP encoder to a specific live stream. The stream key is like a password that allows the encoder to access the specific live stream on the server and start sending data to it. It is an important security measure to prevent unauthorized access to the live stream, as the stream key is needed to begin streaming to a specific event or channel. It's important to keep the stream key safe and secure. You need to enter the |
|playback_url||The playback URL is the web address that viewers can use to watch the live stream. Viewers can enter the playback URL into their web browser or use a media player that supports HLS or LHLS streaming to watch the live stream.|
Step 3: Specify RTMP ingestion URL for live streaming
In your application, enter the ingestion URL you generated in the previous step.
If you're using OBS, then enter the ingest server URL and stream key separately.
However, for ffmpeg, you must specify both the ingest URL and the stream key together. For example:
ffmpeg -re -f lavfi -i "testsrc=size=1280x720 [out0]; sine=frequency=500 [out1]" \
-acodec aac -vcodec h264 -f flv \
Fetch details of a livestream
Using the livestream ID that you generated in the previous step, you can fetch details of livestream.
This request returns the
curl --location \
--request GET 'https://api.dyte.io/v2/livestreams/9fb22eea-3392-42ad-b884-1129a4f517d2' \
--header 'Authorization: Basic ZGVtbzpwQDU1dzByZA=='
The ingest and viewer seconds details are returned after 40-50 seconds; until then, they default to 60.