Skip to main content

External Writers

What are external writers?

The external writer allows you to build your own custom outputs using any of the MistServer outputs.

You will have to set a protocol handler that uses your implementation. When it matches MistServer will provide whatever commandline command you have provided with the requested streamdata over standard input. Information will be printed to standard out and log messages to standard error.

This sounds more confusion than it is once you start using it. Every external writer is build up from 3 options:

OptionDescription
Human Readable NameThis is the name to later identify the external writer you made.
CommandlineThis is the command line (with optional arguments) that will be run as the writer.
URI protocols handledWhich protocol handlers are used to identify when MistServer should use the commandline.

The external writer cannot overwrite the output handlers already available within MistServer. As an example adding rtmp as a handler will not trigger the external writer as MistServer already handles that through the RTMP output. You could however use rtmp-new:// instead.

How to select what type of stream data goes into the external writer

This is a question we often get and it's much easier than you'd expect. You simply add the extension of the protocol you wish to receive.

If you for example create an HTTP POST upload, you would upload mp4 by using http://address/stream.mp4 while mkv would simply be http://address/stream.mkv. Some protocols such as RTMP or SRT are not selectable like this, however since they enjoy a full implementation within MistServer that shouldn't be a problem.

Examples of external writers

basic HTTP upload

MistServer by itself does not support HTTP post. However you could simply add it by creating an external writer with the following command line:

OptionDescription
Human Readable Namehttp-put
Command linecurl -T -
URI protocols handledhttp

This would allow you to write any output as HTTP put when you try to push towards http://server.com/file.ext. The ext part can be changed to the various outputs within MistServer, for example http://server.com/file.mp4 for mp4.

S3 compatible upload

Mistserver currently does not support S3, luckily our friends at Livepeer have created an external writer specifically for S3 storage upload. It is available here.

OptionDescrption
Human Readable NameS3 upload
Command line/path/to/livepeer-catalyst-uploader
Uri protocols handleds3+http, s3 , s3+https

For more instructions on how to use it see the README available on github.

To make the S3 usage easier we would recommend creating static variable containing the S3 account & bucket location.

Example push towards S3 using the livepeer-catalyst-uploader:

Source: streamname
Target: s3+https://${s3acc}@${s3path}/$basename/$year_$month_$day_$hour_$minute_$second.ext

  • ${s3acc} would be the AWS_KEY:AWS_SECRET
  • ${s3path} would be the s3address.com/bucket/
    • Keep in mind that the address should be without any scheme (http:// or https://) as the beginning portion of the push target already has the scheme.

For possible push methods please look at our [pushing documentation][pushing].