Create a stream

Methods: GET

Endpoint: https://www.pushrcdn.com/api/v2/stream
Parameters
  • All parameters are required!
Field Type Values Description
action string create Create a new stream
name string any (UTF-8 only) Stream name
encoder string eu, us, sg Ingestion encoder location
thumb integer 0, 1 Create an image thumbnail
vod integer 0, 1 Record the stream for VOD viewing
mux integer 0, 1 Enable remuxed output
360p integer 0, 1 Enable 360p@500Kbps VBR output
480p integer 0, 1 Enable 480p@700Kbps VBR output
576p integer 0, 1 Enable 576p@1Mbps VBR output
720p integer 0, 1 Enable 720p@2.2Mbps VBR output
1080p integer 0, 1 Enable 1080p@3.5Mbps VBR output
Headers
Field Type Description
APIKEY string Account API key
Example
    curl -d "action=create" \
         -d "name=test stream" \
         -d "encoder=eu" \
         -d "thumb=1" \
         -d "vod=1" \
         -d "mux=0" \
         -d "360p=0" \
         -d "480p=1" \
         -d "576p=0" \
         -d "720p=0" \
         -d "1080p=0" \
         -H "Accept: application/json" \
         -H "Content-Type: application/json" \ 
         -H "APIKEY: 2d49e8f645d90818783c4e6c46f32ca0677ac401" \ 
         -X GET "https://www.pushrcdn.com/api/v2/stream"
Response
{  
   "status":"success",
   "id":"1268",
   "rtmp_key":"1268?auth=802267e0dedf9b1ee422460bed2ac23a",
   "rtmp_server":"trn_61819.r-cdn.com/live",
   "hls_link":"https://hls319318.r-cdn.com/trn_61819/1268/480p/playlist.m3u8",
   "thumb":"https://cdn.mysite.com/vod/1268/thumb.jpg",
   "vod":"https://cdn.mysite.com/vod/1268/1268-480p.mp4"
}
HTTP Code JSON Description
200 {"status":"success"} Returns stream data
401/403/422 {"status":"error"} Returns error description
Notes
  • VOD recording: Setting the vod parameter to 1 will record the stream encoded in H264, in a MP4 container with it's MOOV atom placed at the start of the video to enable progressive streaming. The resulting video file will have a resolution equal to the highest output preset selected during the creation of the stream. By default, the video will be uploaded to your CDN's storage as soon as the stream has ended. The default directory for uploads uploads is /vod/[stream_id]/. If it does not exist it will be automatically created for you.

  • Thumbnails: Setting the thumb parameter to 1 will create an image thumbnail in original resolution from a single frame 5 seconds into the stream. The resulting JPG image will be automatically transferred to the the /vod/[stream_id]/ directory as soon as it is created. By default, all thumbnails are named thumb.jpg.

  • Output Resolutions: You can select one or more output resolutions. If more than one resoluion is selected, the resulting stream will be created in an adaptive bitrate HLS format.

Due to HLS latency, there is an average delay of 20 seconds between then moment a stream is started and the moment when viewers can start watching it via the hls_link. During this time the hls_url would return HTTP404 or HTTP403. If you are automatically publishing streams in your website, app or service, we recommend that you query the hls_link continuously and wait for a HTTP200 response which can be used as a trigger for publishing.