{"id":2146,"date":"2021-01-03T15:02:14","date_gmt":"2021-01-03T13:02:14","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=2146"},"modified":"2021-01-10T12:31:46","modified_gmt":"2021-01-10T10:31:46","slug":"reference-streaming-media-hls-streaming-server","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/2146","title":{"rendered":"Reference HTTP Live Streaming (HLS) server application"},"content":{"rendered":"\n<p>StreamingServer is the application I am using as internal testbed for various media processing and encoding primitives. As an application (or service) it is capable to stream HLS assets preparing them on the fly without need to keep and host real media files. The functionality includes:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Encodes and multiplexes <a href=\"https:\/\/en.wikipedia.org\/wiki\/ISO\/IEC_base_media_file_format\">ISO BMFF Byte Stream Format<\/a> media segments with <a href=\"https:\/\/en.wikipedia.org\/wiki\/Advanced_Audio_Coding\">AAC<\/a> audio and H.264\/<a href=\"https:\/\/en.wikipedia.org\/wiki\/Advanced_Video_Coding\">AVC<\/a>, H.265\/<a href=\"https:\/\/en.wikipedia.org\/wiki\/High_Efficiency_Video_Coding\">HEVC<\/a> video, exposing them as <a href=\"https:\/\/en.wikipedia.org\/wiki\/HTTP_Live_Streaming\">HLS<\/a> assets (see also <a href=\"https:\/\/tools.ietf.org\/html\/rfc8216\">RFC 8216<\/a> &#8220;HTTP Live Streaming&#8221;)<\/li><li>Supports video only, audio only, video and audio assets<\/li><li>Supports parts of <a href=\"https:\/\/www.iso.org\/standard\/68042.html#:~:text=ISO%2FIEC%2023001%2D7%3A2016%20specifies%20common%20encryption%20formats,common%20encrypted%20file%20or%20stream.\">ISO\/IEC 23001-7<\/a> &#8220;Common encryption in ISO base media file format files&#8221; specification and implements &#8216;cenc&#8217; and &#8216;cbcs&#8217; encryption schemes with AES-CTR-128 and AES-CBC-128 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Block_cipher_mode_of_operation\">encryption modes of operation<\/a> respectively<\/li><li>Implemetns encryption layouts as supported by <a href=\"https:\/\/www.microsoft.com\/playready\/overview\/\">Microsoft PlayReady DRM<\/a> implementations, and specifically <a href=\"https:\/\/docs.microsoft.com\/en-us\/samples\/microsoft\/windows-universal-samples\/playready\/\">Microsoft PlayReady sample<\/a><\/li><li>Supports live HLS assets, including live finite and live infinite assets<\/li><li>Encoding services are provided by underlying <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/medfound\/microsoft-media-foundation-sdk\">Media Foundation<\/a> encoders; due to state of Media Foundation and, specifically, awful quality of vendor specific third party vendor integrations the application (a) might have issues with specific video cards, (b) implements built-in encoding based on <a href=\"https:\/\/developer.nvidia.com\/nvidia-video-codec-sdk\">NVIDIA Video Codec SDK<\/a> for NVIDIA GPUs, (c) offers software only mode for GPU agnostic operation<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/AA.png\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"541\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/AA-800x541.png\" alt=\"\" class=\"wp-image-2147\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/AA-800x541.png 800w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/AA-320x217.png 320w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/AA-768x520.png 768w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/AA-1536x1039.png 1536w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/AA-2048x1386.png 2048w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/AA-600x406.png 600w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/AA-1040x704.png 1040w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/figure>\n\n\n\n<p>The application assumes just one client and its streaming services are, generally speaking, limited by trivial HTTP serving loop. Still multiple clients should be able to request data in parallel too.<\/p>\n\n\n\n<p>It is possible to dump produced responses as files for retroactive review. Unless responses are written to files, they are streamed in HTTP chunked mode at lowest latency.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Quick start<\/h3>\n\n\n\n<p>Start the application with privilege elevation to enable its initialization with <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/http\/http-server-api-overview\">HTTP Server API<\/a> services. Unless overridden with command line parameters, the application uses first available DXGI device for hardware assisted video encoding, and exposes its HTTP functionality via http:\/\/localhost\/hls base. Open <a href=\"http:\/\/localhost\/hls\/about\">http:\/\/localhost\/hls\/about<\/a> to get up to date syntax for command line and URI; also to check the status of the application.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"652\" height=\"600\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/image-652x600.png\" alt=\"\" class=\"wp-image-2149\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/image-652x600.png 652w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/image-320x295.png 320w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/image-768x707.png 768w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/image-1536x1414.png 1536w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/image-600x552.png 600w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/image-1040x957.png 1040w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/image.png 1569w\" sizes=\"auto, (max-width: 652px) 100vw, 652px\" \/><\/a><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Problem resolution<\/h4>\n\n\n\n<p>The application is best suited for use with NVIDIA GPUs doing hardware H.264 video encoding. In the case of video encoding issues, it makes sense to start the application with &#8220;-Software&#8221; switch to put it into software only mode: video frames will be generated by <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/direct2d\/direct2d-portal\">Direct2D<\/a> into <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/wic\/-wic-lh\">WIC<\/a> bitmaps instead of <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/direct3ddxgi\/dx-graphics-dxgi\">DXGI<\/a> and <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/direct3d11\/atoc-dx-graphics-direct3d-11\">Direct3D 11<\/a> textures, video encoders will use system memory backed <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/medfound\/microsoft-media-foundation-sdk\">Media Foundation<\/a> media buffers and samples.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Download links<\/h3>\n\n\n\n<p>Binaries:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li> 64-bit: <a href=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2021\/01\/StreamingServer-20210103-6edf45df4ded7b6457362d699a529372b3734ce0.zip\">StreamingServer.exe<\/a> (in .ZIP archive)<\/li><li> License: This software is free to use; builds have time based expiration<\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>StreamingServer is the application I am using as internal testbed for various media processing and encoding primitives. As an application (or service) it is capable to stream HLS assets preparing them on the fly without need to keep and host real media files. The functionality includes: Encodes and multiplexes ISO BMFF Byte Stream Format media&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/2146\">Read the full article<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[485,379,504,578,615,318,486],"class_list":["post-2146","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-audio","tag-h-264","tag-h-265","tag-hls","tag-streamingserver","tag-tool","tag-video"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/2146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/comments?post=2146"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/2146\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=2146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=2146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=2146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}