{"id":1148,"date":"2012-12-19T17:26:59","date_gmt":"2012-12-19T16:26:59","guid":{"rendered":"http:\/\/www.alkannoide.com\/?p=1148"},"modified":"2013-06-14T17:09:55","modified_gmt":"2013-06-14T15:09:55","slug":"adobe-media-server-setup-phls-live-stream","status":"publish","type":"post","link":"https:\/\/www.alkannoide.com\/2012\/12\/19\/adobe-media-server-setup-phls-live-stream\/","title":{"rendered":"Adobe Flash Media Server 4.5 – Setup PHLS live stream"},"content":{"rendered":"
<\/a> <\/p>\n First, we will push not one, but multiple RTMP streams. Remember, HLS is an adaptive bit rate protocol, so you need to use some bitrate as input. FMS will rewrap the content to the good output. In this case, I will push 4 stream at 200, 400, 600 and 800 kbits\/s.<\/p>\n <\/a><\/p>\n But where do we push the content ? Here is the template url :<\/p>\n rtmp:\/\/ams_address<\/em>\/livepkgr\/stream_name<\/em>?adbe-live-event=event_name<\/em><\/strong><\/p>\n Apply this template with the previous data (192.168.0.2 is the address of the FMS), we will have :<\/p>\n Ok, now we will check if the stream are correctly pushed. Have a look on the FMS administration and go to Manage Server<\/strong> -> Select the server<\/strong> -> Applications<\/strong><\/p>\n <\/a><\/p>\n Another solution, to check the content is correctly pushed, is to connect to the server via ssh, in my case (I used Linux), and check if there is some files in\u00a0\/mnt\/applications\/livepkgr\/events\/_definst_\/<\/strong>eventname<\/strong>\u00a0<\/em> like this kind of files : Then, and here is the magic of FMS :-), you can watch you content… to be more precise, you can stream each bitrate separately with the player:<\/p>\n Try the differents URLs in iOS device,\u00a0Quicktime or VLC and you can be able to view the live content.\u00a0We have some single\u00a0bit rate\u00a0stream and at the beginning of this post, I wanted an adaptive\u00a0bit rate live stream .<\/p>\n So finally, we create a m3u8 manifest file which contains our\u00a0different\u00a0sub-streams (the manifest for each bit rate).<\/p>\n Put this file at the root folder of FMS and try again with the player (for example the address will be at : http:\/\/192.168.0.2\/manifest.m3u8). You can view the stream adapt to the band-with available. \ud83d\ude09<\/p>\n We made a big part of the job. We have HLS live stream which is adaptive to the\u00a0bandwidth. The question is how to encrypt the content and this operation will be made by \u00a0Adobe Flash Media Server. To do that, we need to change configuration files. When you change the configuration, you need to restart FMS :<\/p>\n The encryption is possible at 3 different levels :<\/p>\n An application is composed by different events. The configuration will be applied to every event in application. The file is located : At event level, the configuration files are located in: If you want all streams (VoD, Live via RTMP, Live via HTTP) will be encrypted, you do it at the server level. The configuration will be updated in\u00a0: For this example, we apply the configuration on the server level, so in the httpd.conf<\/em>. To do it, we will add three directives<\/a> in the file :<\/p>\n There is a key file provided when you had installed FMS. It is located in rootinstall\/phls\/<\/em> and named liveevent.bin.\u00a0<\/em>Update the Apache configuration file with the good directive’s value. The directive are located in the tag :<\/p>\n Here is an example<\/p>\n Ok, save the file. As you can see, the key will the available at this url http:\/\/192.168.0.2\/hls-key\/liveeventkey.bin but if you try to access it, the file is in 404. It is normal, you need to add one thing in the httpd.conf : the hls-key is not defined, so you need to setup it.<\/p>\n Save the file again and restart the server.<\/p>\n You can now test the stream (http:\/\/192.168.0.2\/manifest.m3u8) with a HLS player (iOS or Quicktime). To validate the content is encrypted, download one of the substream for example http:\/\/192.168.0.2\/hls-live\/livepkgr\/_definst_\/mylive\/200k.m3u8. You find this line :<\/p>\n If you look it, your content is encrypted, you can now enjoy streaming PHLS live \ud83d\ude42<\/p>\n Sources :<\/p>\n Here is a How to, the objective is to demonstrate the setup of a PHLS live stream. PHLS means Protected HLS : the custom format of HLS by Adobe. The protection is realized with a AES-128 encryption on the content. To make this configuration, you need a streaming server which will push content via RTMP. […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[69,46],"tags":[66,72],"_links":{"self":[{"href":"https:\/\/www.alkannoide.com\/wp-json\/wp\/v2\/posts\/1148"}],"collection":[{"href":"https:\/\/www.alkannoide.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.alkannoide.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.alkannoide.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.alkannoide.com\/wp-json\/wp\/v2\/comments?post=1148"}],"version-history":[{"count":78,"href":"https:\/\/www.alkannoide.com\/wp-json\/wp\/v2\/posts\/1148\/revisions"}],"predecessor-version":[{"id":1533,"href":"https:\/\/www.alkannoide.com\/wp-json\/wp\/v2\/posts\/1148\/revisions\/1533"}],"wp:attachment":[{"href":"https:\/\/www.alkannoide.com\/wp-json\/wp\/v2\/media?parent=1148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.alkannoide.com\/wp-json\/wp\/v2\/categories?post=1148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.alkannoide.com\/wp-json\/wp\/v2\/tags?post=1148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\nHere is a How to, the objective is to demonstrate the setup of a PHLS live stream. PHLS means Protected HLS : the custom format of HLS by Adobe. The protection is realized with a AES-128 encryption on the content. To make this configuration, you need a streaming server which will push content via RTMP. Some live transcoders are available from ElementalLive to ffmpeg. And you need too a Adobe Media Server<\/a>\u00a04.5 installed to complete this how to. \u00a0All I write in this post is available via the\u00a0FMS documentation<\/a>.<\/p>\nSetup HLS live stream<\/h2>\n
\n
\nMTQ1OTkwMzc5OQ=.stream<\/em><\/strong> or NDE3MDY5NTk0OQ=.stream<\/em><\/strong>. <\/em>It can be useful to check the presence of this files in order to manage your live stream platform based on FMS.<\/p>\n\n
\r\n#EXTM3U\r\n#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=200000\r\nhttp:\/\/192.168.0.2\/hls-live\/livepkgr\/_definst_\/mylive\/200k.m3u8\r\n#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=400000\r\nhttp:\/\/192.168.0.2\/hls-live\/livepkgr\/_definst_\/mylive\/400k.m3u8\r\n#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=600000\r\nhttp:\/\/192.168.0.2\/hls-live\/livepkgr\/_definst_\/mylive\/600k.m3u8\r\n#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=800000\r\nhttp:\/\/192.168.0.2\/hls-live\/livepkgr\/_definst_\/mylive\/800k.m3u8\r\n<\/pre>\n
Add encryption and setup PHLS live stream<\/h2>\n
rootinstall\/server restart<\/pre>\n
\n
\nrootinstall<\/em>\/applications\/application_name<\/em>\/Application.xml<\/p>\n
\nrootinstall<\/i>\/applications\/application_name<\/em>\/events\/_definst_\/event_name<\/em><\/p>\n
\nrootinstall<\/em>\/Apache2.2\/conf\/httpd.conf<\/p>\n\n
<Location \/hls-live><\/pre>\n
\r\n<Location \/hls-live>\r\n HLSHttpStreamingEnabled true\r\n HttpStreamingLiveEventPath "\/mnt\/applications"\r\n HttpStreamingContentPath "\/mnt\/applications"\r\n HLSMediaFileDuration 8000\r\n HLSSlidingWindowLength 6\r\n HLSFmsDirPath ".."\r\n HLSM3U8MaxAge 2\r\n HLSTSSegmentMaxAge -1\r\n\r\n HLSEncryptionScope server\r\n HLSEncryptCipherKeyFile "..\/phls\/liveeventkey.bin"\r\n HLSEncryptKeyURI "http:\/\/192.168.0.2\/hls-key\/liveeventkey.bin"\r\n\r\n Options -Indexes FollowSymLinks\r\n<\/Location>\r\n<\/pre>\n
\r\n<Location \/hls-key>\r\n HLSEncryptHostCipherKey true # if true, this is the cypher key location\r\n HLSFmsDirPath ".." # the folder of the AMS\r\n HLSEncryptKeyRepository "..\/phls" # the folder where the keys are located\r\n<\/Location>\r\n<\/pre>\n
#EXT-X-KEY:METHOD=AES-128,URI="http:\/\/192.168.0.2\/hls-key\/liveeventkey.bin",IV=0XU806869759IJTE74645447<\/pre>\n
\n