The config.json
file has basically 2 sections
For Developers
The underlying data structures for these can be found in endpoint.go and enums can be found in endpoint_enums.go. We may periodically inject new configs into your config.json, but that should be only if they are required with a sane default or inert.
"server": { "http_port": 8080, "https_port": 8443, "ssl_cert": "server.crt", "ssl_key": "server.key", "binding_address": "127.0.0.1", "crossdomain_xml_file": "./example/crossdomain.xml" }
This allows you to set what ports and IP addresses you'd like to listen on. You can also supply where your SSL certificates and key should be located or created. They should be in PEM format.
This is where the meat of your config will be.
"endpoints": [ { "id": "EXAMPLE_ENDPOINT", "source": "./example/video/kelloggs.mp4", "outputdir": "./out/EXAMPLE_ENDPOINT", "type": "live", "default_headers": { "another-custom-header": [ "\"foo\", \"bar\"" ], "my-custom-header": [ "foo", "bar" ] }, "manual_command": [ "transcode.cli.executable", "-arguments", "-anotherArg", "%SOURCE%", "%OUTPUTDIRECTORY%/%DISKID%.out" ] } ]
A few things you should know:
id
must be unique and will be the first segment of your endpoint URL pathoverride_disk_id
will default to be id and can usually be ommitted. This is only for when you need different endpoints that share the same transcoder outputoutputdir
has enough disk space to handle whatever you're asking fakeOrigin to generate. This should also be unique to each override_disk_id
.manual_command
includes some string required token replacements to enable fakeOrigin to parse the outputTo help make things a bit easier, you can take a look at some samples on how to build endpoints. The transcoder phase will be skipped for static and dir type
as well as other type
where the a hash of the input file and the manual_command
are unchanged.
You cannot use unescaped spaces in commands. Each segment of the command is a separate entry in the array.
Since fakeOrigin still needs to know about where certain things are, such as the metadata generation, file organization, and the live manifest interceptor, a set of tokens are defined for use in a manual command. These are mostly taken from the endpoint properties themselves.
%DISKID% : Identifier for use in file paths, defaults to same as ID %ENDPOINTTYPE% : Endpoint Type [live, vod, event, static, dir] %ID% : Identifier for use in url paths %MASTERMANIFEST% : A primary video manifest path on disk [OutputDirectory + "/" + DiskID + ".m3u8"] %OUTPUTDIRECTORY% : The directory on disk for output files %SOURCE% : The original source file used in transcoding
When writing manual commands, you really want to aim for your transcoder to output all files into a single directory (%OUTPUTDIRECTORY%) after consuming your single source asset (%SOURCE%) with a primary manifest (%MASTERMANIFEST%). In fact, these 3 parameters are required.
When using HLS with adaptive bitrate layers, the master manifest generator within fakeOrigin expects all layer manifests in the %OUTPUTDIRECTORY%
with the format %DISKID%.*(?<width>\d+)x(?<height>\d+)-(?<bandwidth>\d+).m3u8
. For example, %DISKID%_1920x1080-40000.m3u8
.
Setting default_headers
in the config file makes sense for cases like video players who can't supply custom HTTP headers. However for testing specific use cases, you can also supply custom headers as a client to override what gets returned in the fakeOrigin response. If you give a header with the Prefix Fakeorigin-
, that prefix will be stripped and the rest of the client header string will be returned.
Example (Normal):
curl -vs4 -o /dev/null http://localhost:8080/SampleVideo/kelloggs.mp4 * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8080 (#0) > GET /SampleVideo/kelloggs.mp4 HTTP/1.1 > Host: localhost:8080 > User-Agent: curl/7.59.0 > Accept: */* > < HTTP/1.1 200 OK < Another-Custom-Header: foo, bar < Content-Type: video/mp4 < My-Custom-Header: foo < My-Custom-Header: bar < Date: Thu, 19 Jul 2018 16:08:35 GMT < Transfer-Encoding: chunked <
Example (With Client Header Override):
curl -vs4 -o /dev/null http://localhost:8080/SampleVideo/kelloggs.mp4 -H 'Fakeorigin-A-Custom_header: foo' -H 'fakeOrigin-Another-Custom-Header: "baz"' * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8080 (#0) > GET /SampleVideo/kelloggs.mp4 HTTP/1.1 > Host: localhost:8080 > User-Agent: curl/7.59.0 > Accept: */* > Fakeorigin-A-Custom_header: foo > Fakeorigin-Another-Custom-Header: "baz" > < HTTP/1.1 200 OK < A-Custom_header: foo < Another-Custom-Header: "baz" < Content-Type: video/mp4 < My-Custom-Header: foo < My-Custom-Header: bar < Date: Thu, 19 Jul 2018 16:10:43 GMT < Transfer-Encoding: chunked <