Skip to content

Commit

Permalink
Merge pull request #4 from unifiedstreaming/custom-config
Browse files Browse the repository at this point in the history
Custom pipeline config
  • Loading branch information
benelgiac authored Mar 16, 2021
2 parents 42e17e3 + 7af6307 commit b64b814
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 1 deletion.
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,61 @@ docker run \
-e REMOTE_STORAGE_URL=http://usp-s3-storage.s3.eu-central-1.amazonaws.com/ \
-e LOG_LEVEL=debug \
-p 1080:80 \
unifiedstreaming/origin:1.10.28
unifiedstreaming/origin:1.10.28-manifest-edit
```

Tutorial
--------
A full tutorial is available at <http://docs.unified-streaming.com/installation/evaluation.html>

Manifest Edit functionality and default pipelines
---------------------------------------------------

This Origin image includes the "Manifest Edit" functionality, allowing you to
test the use cases included "out-of-the-box" in our Plugins Library, which
are documented in the Use Cases doc page
<https://docs.unified-streaming.com/documentation/manifest-edit/use_cases/index.html>.

You can enable each use case by adding to any `/.mpd` url a query parameter
passing a pipeline name, which will generate an "edited" manifest.
The available pipelines are:

- `?pipeline=adaptation_sets_order`
- `?pipeline=adaptation_sets_removal`
- `?pipeline=adaptation_sets_representations_order`
- `?pipeline=adaptation_sets_switching`
- `?pipeline=low_latency`
- `?pipeline=low_latency_with_essential_property`
- `?pipeline=representations_order`
- `?pipeline=representations_removal`
- `?pipeline=supplemental_property_add`
- `?pipeline=utc_add`
- `?pipeline=utc_change`
- `?pipeline=utc_remove`

These pre-configured use cases may or may not apply at all to your content.

Manifest Edit customized pipeline
---------------------------------

If you want to experiment creating your own pipeline, the suggested way to
do so is to mount in the docker image the provided `my_use_case.yaml` file
using additional docker run options (see the following example):

```bash
docker run \
-e USP_LICENSE_KEY=<license_key> \
-e REMOTE_STORAGE_URL=http://usp-s3-storage.s3.eu-central-1.amazonaws.com/ \
-e LOG_LEVEL=debug \
-v "$(pwd)"/my_use_case.yaml:/usr/share/manifest-edit/my_use_case.yaml \
-e MY_USE_CASE=my_use_case \
-p 1080:80 \
unifiedstreaming/origin:1.10.28-manifest-edit
```

You can now edit the `my_use_case.yaml` local file based on your needs. Refer
to individual plugins documentation for instructions on how to do so. Any
saved change will be immediately available: the corresponding pipeline can be
invoked with the query parameter

- `?pipeline=my_use_case`
13 changes: 13 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ if [ -z "$USP_LICENSE_KEY" ]
exit 1
fi

# test if custom manifest edit pipeline has been set and corresponding
# configuration file has been mounted at the right location
if [ $MY_USE_CASE ] && [ -f "/usr/share/manifest-edit/$MY_USE_CASE.yaml" ]
then
export MY_USE_CASE_FILTER_LINE="SetOutputFilter ef_${MY_USE_CASE}"
else
export MY_USE_CASE_FILTER_LINE=" "
export MY_USE_CASE=not_implemented
fi

# set remote path
if [ $REMOTE_PATH ]
then
Expand Down Expand Up @@ -53,6 +63,9 @@ if [ $TRANSCODE_PATH ] && [ $TRANSCODE_URL ]
/bin/sed "s@{{TRANSCODE_PATH}}@${TRANSCODE_PATH}@g; s@{{TRANSCODE_URL}}@${TRANSCODE_URL}@g; s@{{REMOTE_STORAGE_URL}}@${REMOTE_STORAGE_URL}@g" /etc/apache2/conf.d/transcode.conf.in > /etc/apache2/conf.d/transcode.conf
fi

# my_use_case
/bin/sed -i "s@{{MY_USE_CASE_FILTER_LINE}}@${MY_USE_CASE_FILTER_LINE}@g; s@{{MY_USE_CASE}}@${MY_USE_CASE}@g" /etc/apache2/conf.d/unified-origin.conf


# USP license
echo $USP_LICENSE_KEY > /etc/usp-license.key
Expand Down
10 changes: 10 additions & 0 deletions my_use_case.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- mpd:
- manifest_edit.plugins.supplemental_property_add:
periods:
- '*' : '.*'
adaptationSets:
- contentType : "video"
representations:
- '*' : '.*'
supplementalPropertyName : "MyCustomName"
supplementalPropertyValue: "MyCustomValue"
7 changes: 7 additions & 0 deletions unified-origin.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ LogFormat {{LOG_FORMAT}} log_format
Define PipelineConfUTCAdd "${ManifestEditConfDir}/utc_add.yaml"
Define PipelineConfUTCChange "${ManifestEditConfDir}/utc_change.yaml"
Define PipelineConfUTCRemove "${ManifestEditConfDir}/utc_remove.yaml"
Define PipelineConfMyUseCase "${ManifestEditConfDir}/{{MY_USE_CASE}}.yaml"

ExtFilterDefine ef_adaptation_sets_order mode=output cmd="${ManifestEditCmdPre}${PipelineConfAdaptationSetsOrder}${ManifestEditCmdPost}"
ExtFilterDefine ef_adaptation_sets_removal mode=output cmd="${ManifestEditCmdPre}${PipelineConfAdaptationSetsRemoval}${ManifestEditCmdPost}"
Expand All @@ -83,6 +84,7 @@ LogFormat {{LOG_FORMAT}} log_format
ExtFilterDefine ef_utc_add mode=output cmd="${ManifestEditCmdPre}${PipelineConfUTCAdd}${ManifestEditCmdPost}"
ExtFilterDefine ef_utc_change mode=output cmd="${ManifestEditCmdPre}${PipelineConfUTCChange}${ManifestEditCmdPost}"
ExtFilterDefine ef_utc_remove mode=output cmd="${ManifestEditCmdPre}${PipelineConfUTCRemove}${ManifestEditCmdPost}"
ExtFilterDefine ef_{{MY_USE_CASE}} mode=output cmd="${ManifestEditCmdPre}${PipelineConfMyUseCase}${ManifestEditCmdPost}"

<LocationMatch ".*\.[is]sm[l]?/\.mpd$">
<If "%{QUERY_STRING} =~ /pipeline=adaptation_sets_order/">
Expand Down Expand Up @@ -145,6 +147,11 @@ LogFormat {{LOG_FORMAT}} log_format
ExtFilterOptions LogStdErr Onfail=abort
</If>

<If "%{QUERY_STRING} =~ /pipeline={{MY_USE_CASE}}/">
{{MY_USE_CASE_FILTER_LINE}}
ExtFilterOptions LogStdErr Onfail=abort
</If>

</LocationMatch>

</VirtualHost>

0 comments on commit b64b814

Please sign in to comment.