Some of these examples make use of ffmpeg, however any script or application that can satisfy the required tokens is sufficient if transcoding is needed. The specific commands used in these examples may vary based on your individual requirements. Refer to the documentation of your transcode command for more information.
{ "id": "HLS_ABR_VOD", "source": "./example/video/kelloggs.mp4", "outputdir": "./out/HLS_ABR_VOD", "type": "vod", "manual_command": [ "ffmpeg", "-y", "-i", "%SOURCE%", "-vf", "scale=w=1280:h=720:force_original_aspect_ratio=decrease", "-c:a", "aac", "-ar", "48000", "-c:v", "h264", "-profile:v", "main", "-crf", "20", "-sc_threshold", "0", "-g", "48", "-keyint_min", "48", "-hls_time", "4", "-hls_playlist_type", "vod", "-b:v", "2800k", "-b:a", "128k", "-hls_list_size", "0", "-hls_segment_filename", "%OUTPUTDIRECTORY%/%DISKID%_seq_%03d_1280x720.ts", "%OUTPUTDIRECTORY%/%DISKID%_1280x720-20000.m3u8", "-vf", "scale=w=1920:h=1080:force_original_aspect_ratio=decrease", "-c:a", "aac", "-ar", "48000", "-c:v", "h264", "-profile:v", "main", "-crf", "20", "-sc_threshold", "0", "-g", "48", "-keyint_min", "48", "-hls_time", "4", "-hls_playlist_type", "vod", "-b:v", "5000k", "-b:a", "192k", "-hls_list_size", "0", "-hls_segment_filename", "%OUTPUTDIRECTORY%/%DISKID%_seq_%03d_1920x1080.ts", "%OUTPUTDIRECTORY%/%DISKID%_1920x1080-40000.m3u8" ] }
{ "id": "DUPLICATE_HLS_ABR_VOD", "override_disk_id": "HLS_ABR_VOD", "source": "./example/video/kelloggs.mp4", "outputdir": "./out/HLS_ABR_VOD", "type": "vod" }
The important bits to notice here is that the override_disk_id, outputdir, & type match our first example. Only the id and default_headers are different. This will cause the transcoder metadata to match and therefore inform fakeOrigin that it shouldn't bother trying to transcode it again.
{ "id": "HLS_ABR_LIVE", "source": "./example/video/kelloggs.mp4", "outputdir": "./out/HLS_ABR_LIVE", "type": "live", "manual_command": [ "ffmpeg", "-y", "-i", "%SOURCE%", "-vf", "scale=w=1280:h=720:force_original_aspect_ratio=decrease", "-c:a", "aac", "-ar", "48000", "-c:v", "h264", "-profile:v", "main", "-crf", "20", "-sc_threshold", "0", "-g", "48", "-keyint_min", "48", "-hls_time", "4", "-hls_playlist_type", "vod", "-b:v", "2800k", "-b:a", "128k", "-hls_list_size", "0", "-hls_segment_filename", "%OUTPUTDIRECTORY%/%DISKID%_seq_%03d_1280x720.ts", "%OUTPUTDIRECTORY%/%DISKID%_1280x720-20000.m3u8", "-vf", "scale=w=1920:h=1080:force_original_aspect_ratio=decrease", "-c:a", "aac", "-ar", "48000", "-c:v", "h264", "-profile:v", "main", "-crf", "20", "-sc_threshold", "0", "-g", "48", "-keyint_min", "48", "-hls_time", "4", "-hls_playlist_type", "vod", "-b:v", "5000k", "-b:a", "192k", "-hls_list_size", "0", "-hls_segment_filename", "%OUTPUTDIRECTORY%/%DISKID%_seq_%03d_1920x1080.ts", "%OUTPUTDIRECTORY%/%DISKID%_1920x1080-40000.m3u8" ] }
On live endpoint types, we intercept the m3u8 requests and rewrite them so that they loop.
{ "id": "HLS_VOD", "source": "./example/video/kelloggs.mp4", "outputdir": "./out/HLS_VOD", "type": "vod", "manual_command": [ "ffmpeg", "-y", "-i", "%SOURCE%", "-vf", "scale=w=1920:h=1080:force_original_aspect_ratio=decrease", "-c:a", "aac", "-ar", "48000", "-c:v", "h264", "-profile:v", "main", "-crf", "20", "-sc_threshold", "0", "-g", "48", "-keyint_min", "48", "-hls_time", "4", "-hls_playlist_type", "vod", "-b:v", "5000k", "-b:a", "192k", "-hls_list_size", "0", "-hls_segment_filename", "%OUTPUTDIRECTORY%/%DISKID%_seq_%03d.ts", "%OUTPUTDIRECTORY%/%DISKID%.m3u8" ] }
{ "id": "HLS_EVENT", "source": "./example/video/kelloggs.mp4", "outputdir": "./out/HLS_EVENT", "type": "event", "manual_command": [ "ffmpeg", "-y", "-i", "%SOURCE%", "-vf", "scale=w=1920:h=1080:force_original_aspect_ratio=decrease", "-c:a", "aac", "-ar", "48000", "-c:v", "h264", "-profile:v", "main", "-crf", "20", "-sc_threshold", "0", "-g", "48", "-keyint_min", "48", "-hls_time", "4", "-hls_playlist_type", "event", "-b:v", "5000k", "-b:a", "192k", "-hls_list_size", "0", "-hls_segment_filename", "%OUTPUTDIRECTORY%/%DISKID%_seq_%03d.ts", "%OUTPUTDIRECTORY%/%DISKID%.m3u8" ] }
{ "id": "SampleVideo", "source": "./example/video/kelloggs.mp4", "outputdir": "./out", "type": "static" }
This shows how to serve single files with fakeOrigin. Also, id must still be unique even if they are different source files.
{ "id": "SampleDir", "source": "./example/video", "outputdir": "./out", "type": "dir" }
This shows how to serve all files in a given directory recursively. Also, id must still be unique even if they are different source files. This type serves each file it finds at startup as a static file.
If you're running into issues with a Javascript-based test player, there is a good chance you may need to get add some default CORS headers to your endpoint config.
"default_headers": { "Access-Control-Allow-Headers": [ "*" ], "Access-Control-Allow-Origin": [ "*" ] }
This is a wide open example and should be tailored to the domains of your test player appropriately.