Skip to content

Commit

Permalink
Added support for Microsoft Stream (#16)
Browse files Browse the repository at this point in the history
Re-added support for Microsoft Stream under the new RTMP config builder design.
  • Loading branch information
michaelkamprath authored May 9, 2020
1 parent 47fec08 commit 1a22e54
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.

### Fixed
* Correct bug in RTMP configuration generation when the audio bit rate is set.
* Reinstated support for Microsoft Stream
* Addressed coding style issues with the python script `rtmp-conf-generator.py`

## [0.3.0]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ You must also create and JSON file with the RTMP rebroadcasting configuration yo
* `endpoint`- This is the name of the RTMP ingest endpoint that the source stream will be pushed to. Defaults to `live` if not specified.
* `rebroadcastList`- _Required_ Contains a list of JSON objects that each configure a distinct RTMP destination that the stream pushed to the ingest endpoint will be rebroadcasted to. At least one destination should be configured. There is no specific limit on the number of destinations except for the hardware limitations of your host. Each destination is configured with the following JSON elements:
* `name` - _Required_ A distinct label for this destination. Can be any alphanumeric string with no white space. Must be distinct from all the other destination names in this list.
* `platform` - _Required_ The platform that this specific rebroadcast stream should be pushed to. The default RTMP destinations will be used for each platform. Supported platforms values are: `youtube`, `facebook`, `twitch`, `instagram`, `periscope`, and `custom`. Note that specifying `custom` will cause the `streamKey` element to be ignored if present and instead use the `customRTMPURL`
* `platform` - _Required_ The platform that this specific rebroadcast stream should be pushed to. The default RTMP destinations will be used for each platform. Supported platforms values are: `youtube`, `facebook`, `twitch`, `instagram`, `periscope`, `microsoft-stream`, and `custom`. Note that specifying `microsoft-stream` or `custom` will cause the `streamKey` element to be ignored if present and instead use the `fullRTMPURL`
* `regionCode` - If `periscope` is specified as the platform for this destination, this is the two letter region code that is part of the Periscope server URL. If undefined, it will default to `ca` (the "US West" region)
* `streamKey` - This is the stream key that identifies the unique stream on the specified platform. This value is provided by the platform. This element must be provided for all `platform` types except for `custom`
* `customRTMPURL` - If `custom` is specified in the `platform`, the URL specified in this element is used as-is for the destination URL.
* `fullRTMPURL` - If `custom` or `microsoft-stream` is specified in the `platform`, the URL specified in this element is used for the forming destination URL. This should include the `rtmp://` prefix. For the `microsoft-stream` platform, this is the full URL provided in their stream set up. This element is ignored for all other platform types.
* `transcode` - If present, the stream will be trancoded before rebroadcasting it to this list item's destination. Note that when using this transcoding, the stream will be trancoded to 30 FPS and CBR bit rate. The value is a JSON object that contains the following configuration elements:
* `pixels` - The pixel dimension that the stream should be transcoded to. Formatted like "1920x1080". If not specified, defaults to "1280x720".
* `videoBitRate` - The video bit rate that should be used when sending the stream to this destination. Should be a number followed by "k" or "m" for kilo- and mega- bits-per-second. If not specified defaults to "4500k".
Expand Down
18 changes: 15 additions & 3 deletions multistreaming-server/rtmp-conf-generator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
import json
import re
import sys

#
# Configuration Templates
Expand Down Expand Up @@ -69,7 +70,7 @@
PUSH_URL_TWITCH = "rtmp://live-cdg.twitch.tv/app/%%STREAM_KEY%%"
PUSH_URL_INSTAGRAM = "rtmp://127.0.0.1:19351/rtmp/%%STREAM_KEY%%"
PUSH_URL_PERISCOPE = "rtmp://%%REGION_CODE%%.pscp.tv:80/x/%%STREAM_KEY%%"

PUSH_URL_MICROSOFT_STREAM = "%%RTMP_URL%% app=live/%%APP_NAME%%"
#
#
#
Expand Down Expand Up @@ -98,7 +99,18 @@ def generatePlatormPushURL(block_config):
)
elif block_config['platform'] == 'custom':
push_url = block_config['customRTMPURL']

elif block_config['platform'] == 'microsoft-stream':
ms_source_url = block_config['fullRTMPURL']
ms_rtmp_url = re.search(r'^(.*)/live/', ms_source_url).group(1)
ms_app_name = re.search(r'/live/(.*)$', ms_source_url).group(1)
push_url = PUSH_URL_MICROSOFT_STREAM.replace(
'%%RTMP_URL%%', ms_rtmp_url
).replace(
'%%APP_NAME%%', ms_app_name
)
else:
print("ERROR - an unsupported platform type was provided in destination configation", file=sys.stderr)
exit(1)
return push_url


Expand Down

0 comments on commit 1a22e54

Please sign in to comment.