HLSã
DASHãªã©ã®
HTTPãããªã³ã³ãã³ãé
ä¿¡ãããã³ã«ã¯ããã©ãŠã¶ã§ãªã³ã©ã€ã³ãããªã³ã³ãã³ããåçãããããåžå Žã§Flashã«åã£ãŠä»£ãããŸããã
ãã ããæåã«ãã©ãã·ã¥ãã
RTMPãããã³ã«ã¯ããããªãœãŒã¹ãããªã¬ãŒãµãŒããŒã«
ã©ã€ããããªãé
ä¿¡ããæãäžè¬çãªæ¹æ³ã®1ã€ã®ãŸãŸã§ãã RTMPã¯ã
Facebook Live ã
Youtube Liveãªã©ãã©ã€ããããªããããŒããã£ã¹ãããããŒããã£ã¹ããããµãŒãã¹ãåŒãç¶ã䜿çšããŸãã ãããã£ãŠãFlashã®å·®ãè¿«ã£ãçµaboutã«é¢ããäºæž¬ãšå£°æã«ãããããããRTMPãããã³ã«ã¯äŸç¶ãšããŠå±æ©ã«atããŠããããããªæŸéã®ãããã«ããããã®äœçœ®ã«å£ã£ãŠããŸããã
ã«ã¡ã©ãããããªããã£ããã£ããRTMPã§ãšã³ã³ãŒãããããšã«ãããå€ãã®ããŒããŠã§ã¢ããã³ãœãããŠã§ã¢ãœãªã¥ãŒã·ã§ã³ãäœæãããŸãã-1ã€ãŸãã¯è€æ°ã®ã«ã¡ã©ã«æ¥ç¶ããåä¿¡ãããããªä¿¡å·ãåŠçããåä¿¡ããç»åãRTMPçµç±ã§ãªã¢ãŒããµãŒããŒãŸãã¯ãµãŒãã¹ã«éä¿¡ããŠãããã«äžç¶ããŸãã å€å
žçãªç¿»èš³ã¹ããŒã ã¯æ¬¡ã®ããã«ãªããŸãã
ãã®ã¹ããŒã ã®æ¬ ç¹ã¯ããããªãããŒããã£ã¹ãã®é
延ãšããèšãããçŽ30ç§ã§ãã HLSãšDASHã®ä»£ããã«Adobe Flash PlayerãšRTMPã䜿çšããå ŽåãFlashãã©ã°ã€ã³ã«æ»ããŸããããã¯ãæ§ããã«èšã£ãŠãããªã³ã©ã€ã³ãããªã衚瀺ããææ°ã®æ段ã§ã¯ãããŸããã
WebRTC
ãã©ã°ã€ã³ãªãã§æå°éã®é
延ã§ã¹ããªãŒã ãåçã§ãããœãªã¥ãŒã·ã§ã³ã¯WebRTCã§ããããµãŒããŒåŽã§
RTMPãWebRTCã«
å€æãããšãå€æ°ã®ããã€ã¹ããã©ãŠã¶ãŒã§ã¹ããªãŒã ãåçããåé¡ã解決ããŸãã
ãã ããããã§ã¯ãWebRTCã¯ãªã¢ã«ã¿ã€ã ã§åŒ·åãããæè¡ã§ããããšãç解ããå¿
èŠããããŸãã ããšãã°ãã»ã°ã¡ã³ããåçŽã«HTTPãããã³ã«ã§éä¿¡ãããåãHTTPïŒHLSïŒãšã¯ç°ãªããWebRTCã¯ã¯ããã«è€éã«åäœãã
RTCPãã£ãŒããã㯠ã垯åå¹
å¶åŸ¡ãé
延ã¿ãŒã²ãã£ã³ã°ã䜿çšããŠããã©ãã£ãã¯ã®éä¿¡è
ãšåä¿¡è
ã®éã§é«å¯åºŠã®ããŒã¿äº€æã䜿çšããŸãã
ãããã£ãŠãåçŽãªã¹ããªãŒã ã®åçã®ããã«WebRTCãæå¹ã«ããåã«ã1ã€ã®ç°¡åãªè³ªåã«çããå¿
èŠ
ããããŸãã
ãããªé
ä¿¡ãããžã§ã¯ãã§äœé
延ããããŸãã ãŸããäœã¬ã€ãã³ã·ãäžèŠãªå Žåã¯ãWebRTCã®ãªãŒããŒããããåé¿ããããã«ãHLSãDASHãªã©ã®ä»ã®é
ä¿¡ãã¯ãããžãŒãæ€èšããããšã¯çã«ããªã£ãŠããŸãã
ä»ã®ããã€ã¹ãšã®äºææ§ãæ倧éã«ããHLSã§ã®é
ä¿¡ã®å¯èœæ§ãç¶æããã«ã¯ãé©åãªã³ãŒããã¯ãéžæããå¿
èŠããããŸãã éåžžãRTMPãšã³ã³ãŒããŒã¯
H.264ãããªã³ãŒããã¯ãšAACãªãŒãã£ãªã³ãŒããã¯ããµããŒãããŠããŸãã ãã®çµã¿åããã¯ããªãæšæºçã§ãããéåžžã«äžè¬çã§ãã
ãã©ãŠã¶ã®WebRTCã¯AACã³ãŒããã¯ããµããŒãããŠããªãããã
AACãOpusã«ããŸãã¯AACãG.711ã«ãã©ã³ã¹ã³ãŒãããå¿
èŠããããŸãã Opusã§ã®ãã©ã³ã¹ã³ãŒãã£ã³ã°ã¯æé«ã®å質ãæäŸããå¿
èŠã«å¿ããŠãèšå®ã䜿çšããŠããã«é«ããããç·©ããããšãã§ããŸãã ãããã£ãŠããã©ã³ã¹ã³ãŒãã£ã³ã°ããå Žåã¯ã
Opusã§è¡ãããšãæãŸããã§ãã
ãµãŒããŒ
ããããªã¹ããªãŒã ã
åä¿¡ã㊠WebRTCããã€ã¹ããåçãããšãã«H.264ã䜿çšãããããããã§ã¯ãã©ã³ã¹ã³ãŒãã£ã³ã°ã¯å¿
èŠãããŸãããã
RTMPã§åä¿¡ãããããªã¯ãã±ããåã解é€ããŠããSRTPãã±ããåïŒWebRTCïŒããå¿
èŠããããŸã ã åãã±ããåã®ããã»ã¹ã¯ããã©ã³ã¹ã³ãŒãã£ã³ã°ãããæããã«CPUæéã®æ¶è²»ãå°ãªããããããå€ãã®çä¿¡ã¹ããªãŒã ãåŠçã§ããŸãã
ãã ãããã¹ãŠã®ããã€ã¹ãH.264ããµããŒãããŠããããã§ã¯ãããŸããã ããšãã°ãAndroidçšã®Chromeãã©ãŠã¶ãŒã¯åžžã«ãã®ã³ãŒããã¯ã䜿çšãããšã¯éããŸããã ãã®å Žåã
VP8 WebRTCã³ãŒããã¯ã®æ¬æ Œçãª
ãã©ã³ã¹ã³ãŒãã£ã³ã°ããªã³ã«ãªããã¹ããŒã ã¯æ¬¡ã®ããã«ãªããŸãã
ãµãŒããŒåŽã®ãã©ã³ã¹ã³ãŒãã£ã³ã°ã¯CPUã«å€§ããªè² æ
ãããããããå¿
èŠã«å¿ããŠçŽ1ãµãŒããŒã³ã¢ãé
眮ããæºåãããå¿
èŠããããŸããããšãã°ã720pãªã©ã®é«è§£å床ã¹ããªãŒã ããã©ã³ã¹ã³ãŒãã£ã³ã°ããŸãã
ã³ãŒããŒ
ãã®ãããªããä»æ§ã®ããã¯ã¹ã¯å€é¡ã®è²»çšãããããããä»æ§ã®24æé365æ¥æŸéãæ·±å»ãªããžãã¹ã¿ã¹ã¯ã«å¿
èŠã§ãã
ããåçŽãªã€ãã³ãããããŒããã£ã¹ãããã«ã¯ããœãããŠã§ã¢ãœãªã¥ãŒã·ã§ã³ãé©ããŠããŸãããã®1ã€ã¯ãAdobeã®
ç¡æã®Live Media Encoderã§ãã
Mac OSã®ãšã³ã³ãŒãããŒãžã§ã³ã¯
ãH.264ããã³AACã³ãŒããã¯ããµããŒãããŠããŸã ã ãã®ãããMacã§Live Media Encoderã䜿çšããå Žåãäœããã®æå³ã§ãåãã³ãŒããã¯ã䜿çšããŠRTMPããããã¯ãŒã¯ã«ãããŒããã£ã¹ãã§ããããŒããŠã§ã¢ãšã³ã³ãŒããŒãŸãã¯ææãœãããŠã§ã¢ã®ä»£ããã«ãªãå¯èœæ§ããããŸãã
ãã¹ãäž
ãŸããã¹ããªãŒã ã䜿çšå¯èœã§ãããRTMPã§åçãããŠããããšã確èªããŸãã RTMPã®åçã§åé¡ããªããã¹ããªãŒã ãé
眮ãããŠããå ŽåãWebRTCãä»ããŠæ¥ç¶ããŸãã
ãããªã¹ããªãŒã ããµãŒããŒã«ã¹ããªãŒãã³ã°ããããã»ã¹ã¯ãããªãã·ã³ã°ãšåŒã°ããå°ãªããšã次ã®ãã®ãå¿
èŠã§ãã
- 䜿çšããã«ã¡ã©ãéžæããŸãã
- RTMPã¹ããªãŒã çºè¡ã¢ãã¬ã¹ãæå®ããŸã
äŸïŒ
rtmpïŒ//192.168.88.59/live - ã¹ããªãŒã åãæå®ãã
äŸïŒ
ã¹ããªãŒã 2229
ãµãŒããŒã®ã¢ãã¬ã¹ãæ£ããå Žåã¯ãã«ã¡ã©ã«ã¢ã¯ã»ã¹ã§ããŸãã[
ã¹ã¿ãŒã ]ãã¿ã³ãã¯ãªãã¯ãããšããšã³ã³ãŒããŒã¯RTMPãä»ããŠãµãŒããŒãžã®æ¥ç¶ãååŸããæå®ãããã¢ãã¬ã¹ã«æå®ãããååstream2229ã§ãããªã¹ããªãŒã ã®ãããªãã·ã¥ãéå§ããŸãã
次ã«ãRTMPãä»ããŠãµãŒããŒãããããªã¹ããªãŒã ãååŸããå¿
èŠããããŸãã ãããè¡ãã«ã¯ã
ãã®ãªã³ã¯ãããå
¥æã§ããåçŽãªFlashã¢ããªã±ãŒã·ã§ã³
Flash Streamingã䜿çšããŸãã ããã¯éåžžã®ãã©ãã·ã¥ãã©ã€ãïŒswfãã¡ã€ã«ïŒã§ãWebããŒãžã«ãããAdobe Flash Playerã§å®è¡ãããŸãã ãããã£ãŠããã®ãã¹ãã®ããã«ã·ã¹ãã ã«Flash Playerãã€ã³ã¹ããŒã«ããã䜿çšå¯èœã§ããããšã確èªããŠãã ããã
ããã§ãåãããŒã¿ãå
¥åããå¿
èŠããããŸãïŒRTMPã¹ããªãŒã ã®ã¢ãã¬ã¹ãšãã®ååã ãã®çµæãWebããŒãžã§ãããªãååŸããŸãã Flash Playerã«ãã£ãŠåçãããŸãã
ããã«ãç®æšã¯WebRTCã䜿çšããŠåçããã¹ãããããšã§ãããFlashã§ã®åçã¯RTMPãšã³ã³ãŒããŒãšç¿»èš³ãµãŒããŒã®åäœã確èªããäžéãã¹ãã«éããªãã£ãããšãæãåºããŸãã
ãã¹ãã§ã¯ããããªã¹ããªãŒã WebRTCãã¬ãŒã€ãŒã䜿çšããŸãã ãµãŒããŒãžã®æ¥ç¶ã«Websocketsãããã³ã«ã䜿çšãããã¢ãã¬ã¹ã¯æ¬¡ã®ããã«ãªãããããã®ãã¬ãŒã€ãŒã¯RTMPã¢ãã¬ã¹ãå¿
èŠãšããŸãããwssïŒ//192.168.88.59ïŒ8443
ããã«ïŒ
wssã¯SSLãä»ããWebãœã±ããã§ã
192.168.88.59-WebRTCãµãŒããŒã¢ãã¬ã¹
8443-Websocket SSLãããã³ã«ã®ãµãŒããŒããŒã
ã¹ããªãŒã ã®ååãšããŠstream2229ãæå®ãããã[
åç ]ãã¯ãªãã¯ããŠãWebRTCã§æ¢ã«ç»åãååŸããŸãã
ãµãŒããŒãžã®æ¥ç¶ãWebsocketçµç±ã§ãããããŒãã8443ã§ããã«ããããããããããªãã©ãã£ãã¯ã¯ãã®æ¥ç¶ãçµç±ããªãããšã«æ³šæããŠãã ããã ãã©ãŠã¶ãŒããã³ãµãŒããŒåŽã§ãããªçšã«ç¹å¥ãªãããªããŒããéããããããã®éãããUDPããŒããä»ããŠãããªãéä¿¡ãããŸãã Websocketãä»ããŠãç°¡åãªåçã³ãã³ããã¹ããŒã¿ã¹ãã³ãŒããã¯ã®èšå®ãããã³WebRTCã«ãšã£ãŠéèŠãªãã®ä»ã®æ
å ±ãéä¿¡ãããŸãã
WebRTCãããªãã©ãã£ãã¯ãã©ã®ããã«çä¿¡ãããã確èªããã«ã¯ãGoogle Chromeãã©ãŠã¶ãŒã䜿çšããåçäžã«chromeãéããŸãïŒ// webrtc-internals
ã°ã©ãã¯ãåä¿¡ãããããªã¹ããªãŒã ã®ãããã¬ãŒããçŽ600 kbpsããã¬ãŒã ã¬ãŒãã28ã30 FPSã§ããããšã瀺ããŠããŸãã
次ã®ã°ã©ãã¯ã倱ãããUDPãã±ããã®æ°ïŒ50ïŒã1ç§ãããã®ãã±ããåä¿¡ã¬ãŒãããããªã¹ããªãŒã ã®è§£å床640x480ããžãã¿ãŒãããã³ãã³ãŒãæéã«é¢ããæ
å ±ãæäŸããŸãã
ãããã£ãŠãAdobe Live Media EncoderããHTML5ã«éä¿¡ãããRTMPãããªã¹ããªãŒã ã®åçããã¹ãããŸãããããã¯ãWebRTCããµããŒããããã©ãŠã¶ãŒã®ããŒãžã§ãããè¿œå ã®ãã©ãŠã¶ãŒãã©ã°ã€ã³ã¯äœ¿çšããŸããã§ããã ãã¹ãã¯ãçä¿¡RTMPã¹ããªãŒã ããµããŒããã
Web Call Server 5ã§è¡ãããRTMPãWebRTCãããã³ãã®ä»ã®ãããã³ã«ãä»ãããã®åŸã®é
ä¿¡ãè¡ãããŸããã
ããŒãžã³ãŒã-WebRTCãã¬ãŒã€ãŒ
WebããŒãžã«åã蟌ãããã®æå°ãã¬ãŒã€ãŒã³ãŒãã¯æ¬¡ã®ããã«ãªããŸã
<html> <head> <script language="javascript" src="flashphoner.js"></script> <script language="javascript" src="player.js"></script> </head> <body onLoad="init()"> <h1>The player</h1> <div id="remoteVideo" style="width:320px;height:240px;border: 1px solid"></div> <input type="button" value="start" onClick="start()"/> <p id="status"></p> </body> </html>
ãã®ã³ãŒãã¯ã
Web SDKã¢ã»ã³ããªã§äœ¿çšå¯èœãª
flashphoner.js API
ãã¡ã€ã«ã«äŸåããŠ
ããŸãã ãã¬ãŒã€ãŒèªäœã¯remoteVideo divèŠçŽ ã«åã蟌ãŸããŸãã
player.jsã¹ã¯ãªããã¯ã
Flashphoner.initïŒïŒã䜿çšããåæåã
Flashphoner.createSessionïŒïŒã䜿çšãããµãŒããŒãžã®æ¥ç¶ã®äœæãWebRTCãããªã¹ããªãŒã ã®
åçsession.createStreamïŒ...ïŒãPlayïŒïŒã® 3ã€ã®é¢æ°ã䜿çšããŸãã
ãµãŒããŒã®æ¥ç¶ç¶æ
ã¯ãESTABLISHEDãDISCONNECTEDãFAILEDã®ã€ãã³ãã䜿çšããŠè¿œè·¡ãããŸãã
ãããªã¹ããªãŒã ã®ã¹ããŒã¿ã¹ã¯ãPLAYINGãSTOPPEDãFAILEDã€ãã³ãã䜿çšããŠè¿œè·¡ãããŸãã
ãããã£ãŠããµãŒããŒãžã®æ¥ç¶ãšãããªã¹ããªãŒã ã®ã¹ããŒã¿ã¹ãå®å
šã«å¶åŸ¡ã§ããŸãã
var remoteVideo; function init(){ Flashphoner.init(); remoteVideo = document.getElementById("remoteVideo"); } function start() { Flashphoner.createSession({urlServer: "wss://wcs5-eu.flashphoner.com:8443"}).on(Flashphoner.constants.SESSION_STATUS.ESTABLISHED, function (session) {
WebRTCãã¬ãŒã€ãŒã®æå°ã³ãŒãã¯ã
ãã®ãªã³ã¯ããããŠã³ããŒãã§ããWebRTCãµãŒããŒWeb Call Server 5ãåäœããå¿
èŠããããŸãããµãŒããŒã¯ãLinuxãã¹ã
https://flashphoner.com/downloadã«ããŠã³ããŒãããŠã€ã³ã¹ããŒã«ããã
ãAmazonã®ã€ã¡ãŒãžãšããŠèµ·åã§ããŸãã
EC2åäœäžã®æå°WebRTCãã¬ãŒã€ãŒã³ãŒã
äžèšã®ãã¬ãŒã€ãŒã®äŸãšã¹ã¯ãªãŒã³ã·ã§ããã«ã¯ãåçãé
眮ããããã®è¿œå ã®ã¹ã¿ã€ã«ãšã¹ã¯ãªãããå«ãŸããŠããŸããã
æå°éã®ã³ãŒãã§ã¯ããµã€ãããŒãžã§æéã®å®è£
ãè¡ãããã«ãæãåçŽãªHTMLãšç°¡ç¥åãããã¹ã¯ãªããã«éå®ããŸããã çµæã¯æ¬¡ã®ããã«ãªããŸãã
ãã®ãã¬ãŒã€ãŒã¯ããµã€ããŸãã¯ãããžã§ã¯ãã®ä»»æã®WebããŒãžã«çµ±åã§ããŸãã
flashphoner.js API
ã¹ã¯ãªãããšãWebããŒãžäžã®ãããªçšã®1ã€ã®divãããã¯ãå«ããã ãã§ãã
WebRTCãšé£æºãããµãŒããŒã¯ãå¥ã®ç¬ç«ãããã·ã³ã«ç©ççã«åžžé§ã§ããWebãããžã§ã¯ãã®ãã¹ãã£ã³ã°ãšã¯äžåæ¥ç¶ãããŸããã
ãã®çµæãWebRTCãã¬ãŒã€ãŒã®ã³ãŒãã説æãããã¬ãŒã€ãŒãWebãµã€ãã®WebããŒãžã«åã蟌ã¿ãç¬èªã®WebãµãŒããŒã«å±éããæ¹æ³ã瀺ããŸããã ãã¬ãŒã€ãŒã¯WebRTC H.264ãããªã¹ããªãŒã ãåçããŸãã RTMPã¹ããªãŒã ã®ãœãŒã¹ã¯Adobe Live Media Encoderã§ãã
åç
§è³æ
Adobe Flash Media Encoder -RTMPãã¹ããªãŒãã³ã°ã§ããAdobeã®
ãšã³ã³ãŒã㌠ã
Flash Streaming Demo -RTMPã¹ããªãŒã ãFlash Playerã§åçããŸãã
Playerã¯ããœãŒã¹ã³ãŒãã䜿çšããWebRTCãã¬ãŒã€ãŒã®æšæºçãªäŸã§ãã
Player Minimal-æå°éã®ãã¬ãŒã€ãŒWebRTC
player.htmlããã³
player.jsã®ã¹ã¯ãªãããããŠã³ããŒãããŸã
WebRTCãµãŒã㌠-RTMPã¹ããªãŒã ãWebRTCçµç±ã§äžç¶ããããã®Web Call Server 5ãµãŒããŒã
Web SDK-ã¢ã»ã³ããªã«ã¯
flashphoner.jsãå«ãŸããŠã
ãŸã -ãã¬ãŒã€ãŒã®APIãã¡ã€ã«ã