CamStreamer App 3.x functionality can be controlled using API once the application is installed and licensed. There are several parameters described below. Mind that CamStreamer App/stream is restarted every time any parameter is changed.
You can get or set multiple global parameters at once usign the following calls:
http://IPADDR[:PORT]/local/camstreamer/param/set.cgi?PARAMNAME=PARAMVALUE[&PARAMNAME=PARAMVALUE]
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.1.5
PARAMNAME is a name of any parameter listed below.
PARAMVALUE is a value you would like to save to CamStreamer App. Special characters in the value has to
be urlenmarkd. See URL encoding
http://IPADDR[:PORT]/local/camstreamer/param/get.cgi?list=PARAMNAME[,PARAMNAME]
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.1.5
PARAMNAME is a name of any parameter listed below.
In CamStreamer App it is possible to set up several output streams directly by setting JSON array to StreamList parameter or by using simpler HTTP API. Every stream has its own parameters (listed below) which can be set or gained by calling HTTP API.
Enable LED light indication on the camera. The light is ON if the stream is established. The light is off once the CamStreamer App is not able to broadcast the video . Valid values: 0, 1
The following HTTP API call list all streams.
http://IPADDR[:PORT]/local/camstreamer/stream/list.cgi?action=get
The following POST API call updates the whole JSON configuration of CamStreamer App.
http://IPADDR[:PORT]/local/camstreamer/stream/list.cgi?action=set
You can add / update a stream by the set.cgi HTTP API call bellow. Mind that the stream added by API is not visible in the CamStreamer App user interface. If you'd like to start a broadcast on YouTube, please use YouTube Live Streaming API. It's necessary to obtain an RTMP ingestion url / key.
http://IPADDR[:PORT]/local/camstreamer/stream/set.cgi?stream_id=STREAMID&PARAMNAME=PARAMVALUE[&PARAMNAME=PARAMVALUE]
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.1.5
STREAMID is a stream identifier (string). A new stream is created if sent stream_id does not exist. If stream_id exists current stream is modified. For API are reserved identifiers with "api" prefix.
PARAMNAME is a name of any stream parameter listed below.
PARAMVALUE is a value you would like to save to the stream. Special characters in the value has to
be urlenmarkd. See URL encoding
You can get a stream parameters by the get.cgi HTTP API call bellow.
http://IPADDR[:PORT]/local/camstreamer/stream/get.cgi?stream_id=STREAMID
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.1.5
STREAMID is a stream identifier.
You can remove a stream by the remove.cgi HTTP API call bellow.
http://IPADDR[:PORT]/local/camstreamer/stream/remove.cgi?stream_id=STREAMID
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.1.5
STREAMID is a stream identifier.
Stop or start the stream using parameter "Enabled". Valid values: 0, 1
Valid values (for selected protocol):
Overwrite the default video parameters. See parameter description (chapter 3.4). You can e.g. choose different camera or View Area using parameter camera=2&resolution=1280x720&overlaypos=200%2C600.
Specify the audio channel. Available values:
none disable the audio channel.
default use the audio channel from the camera (e.g. mic./line input).
file: FILEPATH use an audio file FILEPATH (mka/mp3) on the file system on the camera (e.g. SD
card). If you want to stream to YouTube with camera without audio, use following settings "audioSource=file:/usr/local/packages/camstreamer/tools/silence.mka"
url: URL use an external (network) audio source (markc AAC or MP3). E.g. internet radio,
another camera or Axis P8221 audio enmarkr. For Axis device:
rtsp://root:password@IPaddress/axis-media/media.amp?audio=1&video=0 Use audio sample rate 44.1KHz and
bitrate 128Kbps. CamStreamer App is not streaming once the external audio is not available.
Time offset for audio/video channel in milliseconds.
Pause stream – the stream will not run, but all other processes are active. Typical API server calls in callApi – the application calls server APIs (creation and ending streams on YouTube).
Determines type of automation.
none automation off
inputX (X is the input number) the stream is turned on only if the given camera input is active
time stream is turned on based on a time interval (startTime / stopTime parameters)
recurrent stream is turned on based on a time schedule (schedule parameter)
Valid only for trigger recurrent, schedule is represented by JSON format. Schedule contains array of intervals where day is a number in range 0-6 (0 for Monday) and time is string in format HH:MM:SS. The time gap between planned events on YouTube must be at least 15 minutes – incorrect settings can cause wrong behavior.
Example:
Two intervals: Monday 8:00 to 9:30, Tuesday 10:00 to Wednesday 10:00
[{ "day_from": 0, "day_to": 0, "time_from": "08:00:00", "time_to": "09:30:00" }, { "day_from": 1, "day_to": 2, "time_from": "10:00:00", "time_to": "10:00:00" }]
(only trigger time) – prepares a stream for a given number of seconds before startTime (calls API, starts to stream).
(only trigger time) - unix timestamp for the beginning of the stream.
(only trigger time) - unix timestamp for the end of the stream.
Activates camera LED diode blinking during the preparation of broadcasting and lighting during streaming. If the same LED is used for more streams the LED lights after the last stream is started. Valid values: 0, 1
Activates camera output with LED diode and set blinking during the preparation of broadcasting and lighting during streaming. If the same output is used for more streams the LED lights after the last stream is started. Valid values: number of camera port with output.
Get the status of your stream via the following request.
http://IPADDR[:PORT]/local/camstreamer/get_streamstat.cgi?stream_id=X
where X is the Stream ID of your stream.
Response:
{"status": 200, "message": "OK", "data": {"net_stats":"110779840 1107300413","stream_bytes_time_ms":1600092179717,"stream_bytes":568335,"start_count":1,"is_streaming":1}}
Redirect your viewers to the current broadcast.
https://camstreamer.com/yt-broadcast-api/SECTOKEN/CSID
where SECTOKEN and CSID are used in "Permanent link" in CamStreamer App user interface. Mind that the SECTOKEN is changed once you use a different YouTube channel.
Example:
https://camstreamer.com/yt-broadcast-api/b7133489237eee1/S-78
Response:
{"broadcast_id":"XCIfaGvbXSs"}
Check whether the YouTube broadcast is live and whether the you Get information from our watchdog. It is suitable for integration with monitoring systems like Nagios, Centreon...
https://camstreamer.com/api/youtubeStatus/SECTOKEN/CSID
where SECTOKEN and CSID are used in "Permanent link" in CamStreamer App user interface. Mind that the SECTOKEN is changed once you use a different YouTube channel.
Response HTTP code:
When you’re creating a new stream, use a different ID than the one created by the CamStreamer App. Our application uses whole numbers higher than 10. Use a prefix like “api_01”. A YouTube stream may be controlled via an API, but YouTube authorization first has to be carried out via a user interface.
In order for the camera to stream, the following conditions must be met: parameter enabled = 1, parameter active = 1 and parameter trigger = none or automation was active (input on or correct time interval)
"enabled":"1", "audioSource":"default", "mediaServerUrl":"rtmp:\/\/a.rtmp.youtube.com\/live2\/rfp-test-2926.q9yk-3wv0-4zzg-78ks"
You can change a stream parameters by the set.cgi HTTP API call bellow.
http://IPADDR[:PORT]/local/camstreamer/stream/set.cgi?stream_id=STREAMID&enabled=1&audioSource=default&mediaServerUrl=rtmp://a.rtmp.youtube.com/live/rfp-test-2926.q9yk-3wv0-4zzg-78ks
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.1.5
STREAMID is a stream identifier (string). A new stream is created if sent stream_id does not exist. If stream_id exists current stream is modified. For API are reserved identifiers with "api" prefix.
"enabled":"0"
You can stop a stream by the set.cgi HTTP API call bellow.
http://IPADDR[:PORT]/local/camstreamer/stream/set.cgi?stream_id=1057&enabled=0
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.1.5
STREAMID is a stream identifier (string). A new stream is created if sent stream_id does not exist. If stream_id exists current stream is modified. For API are reserved identifiers with "api" prefix.
"enabled":"1", "audioSource":"default", "trigger":"input0", "mediaServerUrl":"rtmp:\/\/a.rtmp.youtube.com\/live2\/rfp-test-2926.q9yk-3wv0-4zzg-78ks"
You can create / modificate a stream by the set.cgi HTTP API call bellow.
http://IPADDR[:PORT]/local/camstreamer/stream/set.cgi?stream_id=1057&enabled=1&audioSource=default&trigger=input0&mediaServerUrl=rtmp%3A%2F%2Fa.rtmp.youtube.com%2Flive2%2Frfp-test-2926.q9yk-3wv0-4zzg-78ks
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.1.5
STREAMID is a stream identifier (string). A new stream is created if sent stream_id does not exist. If stream_id exists current stream is modified. For API are reserved identifiers with "api" prefix.
"enabled":"1", "audioSource":"default", "trigger":"time", "startTime":"1551694200", "stopTime":"1551705000", "mediaServerUrl":"rtmp:\/\/a.rtmp.youtube.com\/live2\/rfp-test-2926.q9yk-3wv0-4zzg-78ks"
You can create / modificate a stream by the set.cgi HTTP API call bellow.
http://IPADDR[:PORT]/local/camstreamer/stream/set.cgi?stream_id=1057&enabled=1&audioSource=default&trigger=time&startTime=1551694200&stopTime=1551705000&mediaServerUrl=rtmp%3A%2F%2Fa.rtmp.youtube.com%2Flive2%2Frfp-test-2926.q9yk-3wv0-4zzg-78ks
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.1.5
STREAMID is a stream identifier (string). A new stream is created if sent stream_id does not exist. If stream_id exists current stream is modified. For API are reserved identifiers with "api" prefix.
Feel free to contact our support in case of any problem.