ソスソスソスソスzソスMソスTソス[ソスoソス[ソス\ソスzソスinginx+nginx-rtmp-moduleソスj

ソスナ終ソスXソスVソスソスソスF 2023.02.23

ソスソスソスTソスv

ソスIソスソスソスfソス}ソスソスソスhソスzソスMソスAソスソスソスCソスuソスzソスMソスソスソスsソスソスソスソスソスソスzソスMソスTソス[ソスoソス[ソスソスソス\ソスzソスソスソスソスBソスソスソスソスソスナは、nginx+nginx-rtmp-moduleソスソスソスgソスpソスソスソスト難ソスソスソスzソスMソスTソス[ソスoソス[ソスソスソス\ソスzソスソスソスソスBソスソスソスソスソスHTTP Live Streamingソス`ソスソスソスナ配ソスMソスソスソスソスB
ソスワゑソスソスAWebソスJソスソスソスソスソスソスレ托ソスソスソスソスソスPCソスソスソスソスJソスソスソスソスソスfソスソスソスEソスソスソスソスソスソスFlash Media Live Encoderソスナ難ソスソスソスzソスMソスTソス[ソスoソス[ソスヨ托ソスソスMソスソスソスAソスソスソスソスzソスMソスTソス[ソスoソス[ソスナは趣ソスMソスソスソスソスソスJソスソスソスソスソスfソスソスソスEソスソスソスソスソスソスHTTP Live Streamingソス`ソスソスソスナ配ソスMソスソスソスソスBソスiソスソスソス}ソスQソスニ)
ソスネゑソスソスAHTTP Live Streamingソス`ソスソスソスソスソスト撰ソスソスナゑソスソスネゑソスソスuソスソスソスEソスUソスソスソスソスソスノゑソスhls.jsソス動会ソスzソスMソスyソス[ソスWソスノ組ソスン搾ソスソズゑソスソスニにゑソスソスAソスソスソスラてのクソスソスソスCソスAソスソスソスgソスiMedia Source Extensions (MSE)ソスソスソスTソス|ソス[ソスgソスソスソストゑソスソスネゑソスWindows 7 ソスソス Internet Explorer 11ソスソスソスソスソスソスソスjソスナ難ソスソスソスソスソスソスソスソスソスナゑソスソスソス謔、ソスノゑソスソスソスB

ソスソスソスネゑソスソスAソス{ソスyソス[ソスWソスナは奇ソスソスソスWebソスTソス[ソスoソス[ソスソスソスメ難ソスソスソスソストゑソスソスソスソスソスフとゑソスソスAnginxソスフ使ソスpソス|ソス[ソスgソスソスハ擾ソスソス80ソスヤではなゑソス8080ソスヤとゑソスソス驍アソスニにゑソスソスソスソスソスソスソスWebソスTソス[ソスoソス[ソスニ包ソスソスソスソスナゑソスソスソス謔、ソスノゑソスソストゑソスソスソスB





ソスソスnginx+nginx-rtmp-moduleソスCソスソスソスXソスgソス[ソスソス

[root@centos ~]# wget https://nginx.org/download/nginx-1.17.3.tar.gzソス@ソスソスソス@nginxソス_ソスEソスソスソスソスソス[ソスh
ソスソスソスナ新ソスナゑソスURLソスソスソス_ソスEソスソスソスソスソス[ソスhソスyソス[ソスWソスナ確ソスFソスソスソス驍アソスソス

[root@centos ~]# tar zxf nginx-*.tar.gzソス@ソスソスソス@nginxソスWソスJ

[root@centos ~]# cd nginx-*ソス@ソスソスソス@nginxソスWソスJソスソスfソスBソスソスソスNソスgソスソスソスヨ移難ソス

[root@centos nginx-1.17.3]# git clone https://github.com/arut/nginx-rtmp-module.gitソス@ソスソスソス@nginx-rtmp-moduleソス_ソスEソスソスソスソスソス[ソスh

[root@centos nginx-1.17.3]# ./configure --add-module=nginx-rtmp-module/ && make && make installソス@ソスソスソス@nginx+nginx-rtmp-moduleソスCソスソスソスXソスgソス[ソスソス

[root@centos nginx-1.17.3]# cdソス@ソスソスソス@nginxソスWソスJソスソスfソスBソスソスソスNソスgソスソスソス抜ゑソスソスソス

[root@centos ~]# rm -rf nginx-*ソス@ソスソスソス@nginxソスWソスJソスソスfソスBソスソスソスNソスgソスソスソスニダソスEソスソスソスソスソス[ソスhソスソスソスソスソスtソス@ソスCソスソスソスソスソス除

ソスソスnginxソスン抵ソス

[root@centos ~]# vi /usr/local/nginx/conf/nginx.confソス@ソスソスソス@nginxソスン抵ソスtソス@ソスCソスソスソスメ集
http {
    server_tokens off;ソス@ソスソスソス@ソスヌ会ソス(ソスoソス[ソスWソスソスソスソスソスソスソスBソスソス)
ソスE
ソスE
ソスE
    server {
        listen       8080;ソス@ソスソスソス@HTTPソス|ソス[ソスgソスヤ搾ソスソスマ更

        faviconソスGソスソスソス[ソスソスソスOソスソスソスソスソスソスソスン抵ソスヌ会ソスソスiソスソスソスソスソスソスソスソスj
        # faviconソスソスソスソスソスンゑソスソスネゑソスソス|ソスフソスソスOソスソスソスoソスヘゑソスソスネゑソスソス謔、ソスノゑソスソスソス
        location /favicon {
            empty_gif;
            access_log    off;
            log_not_found off;
        }
        faviconソスGソスソスソス[ソスソスソスOソスソスソスソスソスソスソスン抵ソスヌ会ソスソスiソスソスソスソスソスワで)

RTMPソスTソス[ソスoソス[ソスン抵ソスソスソスナ鯉ソスソスソスヨ追会ソスソスiソスソスソスソスソスソスソスソスj
rtmp_auto_push on;
rtmp {
    server {
        listen 1935;
        access_log logs/rtmp_access.log;
        chunk_size 4096;
        timeout 10s;
        # ソスソスソスCソスuソスzソスMソスン抵ソス
        application live {
            live on;

            # 192.168.1.0/24ソスソスソスソスフみソスソスCソスuソスzソスMソスfソス[ソス^ソスフ趣ソスMソスソスソスソスソスソス
            allow publish 192.168.1.0/24;
            deny publish all;

            # HLSソスzソスMソスン抵ソス
            hls on;
            hls_path /usr/local/nginx/html/live; # HLS(HTTP Live Streaming)ソスtソス@ソスCソスソスソス成ソスソス
            hls_fragment 10s; # HLS(HTTP Live Streaming)ソスtソス@ソスCソスソスソスソスソスソスソスソスソスソス
        }
        # ソスIソスソスソスfソス}ソスソスソスhソスzソスMソスン抵ソス
        application vod {
            play /usr/local/nginx/html/vod; # ソスソスソスソスtソス@ソスCソスソスソスiソス[ソスソス
        }
    }
}
RTMPソスTソス[ソスoソス[ソスン抵ソスソスソスナ鯉ソスソスソスヨ追会ソスソスiソスソスソスソスソスワで)

[root@centos ~]# mkdir /usr/local/nginx/html/vodソス@ソスソスソス@ソスソスソスソスtソス@ソスCソスソスソスiソス[ソスソスfソスBソスソスソスNソスgソスソスソス成

[root@centos ~]# chown nobody /usr/local/nginx/html/vodソス@ソスソスソス@ソスソスソスソスtソス@ソスCソスソスソスiソス[ソスソスfソスBソスソスソスNソスgソスソスソスソスソスLソスメ変更

[root@centos ~]# vi /etc/logrotate.d/nginxソス@ソスソスソス@nginxソスソスソスOソスソスソス[ソスeソス[ソスVソスソスソスソスソスン抵ソスtソス@ソスCソスソスソス成
/usr/local/nginx/logs/*.log {
    missingok
    notifempty
    sharedscripts
    delaycompress
    postrotate
        /bin/systemctl reload nginx.service > /dev/null 2>/dev/null || true
    endscript
}

ソスソスnginxソスNソスソス

ソスiソスPソスjnginxソスNソスソス
[root@centos ~]# vi /usr/lib/systemd/system/nginx.serviceソス@ソスソスソス@nginxソスNソスソスソスXソスNソスソスソスvソスgソス成
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target

[root@centos ~]# systemctl start nginxソス@ソスソスソス@nginxソスNソスソス

[root@centos ~]# systemctl enable nginxソス@ソスソスソス@nginxソスソスソスソスソスNソスソスソスン抵ソス

ソスiソスQソスjTCP8080ソスソスソス|ソス[ソスgソスJソスソス
ソスyソスソスソス[ソス^ソス[ソスz
ソスソスソス[ソス^ソス[ソスソスソスフ設抵ソスナ、TCP8080ソスソスソス|ソス[ソスgソスヨのアソスNソスZソスXソスソスソスTソス[ソスoソス[ソスノ転ソスソスソスソスソスソス謔、ソスノゑソスソスソスB
ソスソスソスソスソス[ソス^ソス[ソスフ設抵ソスヘ各ソスソスソス[ソス^ソス[ソスフマソスjソスソスソスAソスソスソスワゑソスソスソスソスソスソス[ソスJソス[ソスハソスソス[ソス^ソス[ソス|ソス[ソスgソスJソスソスソス闖ソスソスソスQソスソス

ソスyソスtソス@ソスCソスAソスEソスHソス[ソスソスソスz
ソスTソス[ソスoソス[ソスソスソスフフソス@ソスCソスAソスEソスHソス[ソスソスソスン抵ソスナ、TCP8080ソスソスソス|ソス[ソスgソスヨのアソスNソスZソスXソスソスソスソスソスツゑソスソスソス謔、ソスノゑソスソスソスB
ソスソスソスtソス@ソスCソスAソスEソスHソス[ソスソスソスン抵ソスヘゑソスソスソスソスソスソスソスQソスソス

Portソス`ソスFソスbソスNソスeソスXソスgソスyソスOソスソスソスソスソスソスソスPortソスJソスソスソスmソスFソスzソスナ「ソスzソスXソスgソスソス(FQDN) ソスワゑソスソスソス ソスOソスソスソス[ソスoソスソスIPソスAソスhソスソスソスXソスvソスノサソス[ソスoソス[ソスソス(ソスソス:centossrv.com)ソスAソスuソス`ソスFソスbソスNソス|ソス[ソスgソスヤ搾ソスソスvソスソス8080ソスニ難ソスソスヘ、ソスuソスソスソスソスソスモ・ソスソスソス事搾ソスソスvソスソスソスmソスFソス`ソスFソスbソスNソスソスソスト「Portソス`ソスFソスbソスNソスソスソスsソスvソス{ソス^ソスソスソスソスソスソスソスソスソスソスソスA
ソスzソスXソスg:centossrv.com
ソス|ソス[ソスg:8080
ソスノアソスNソスZソスXソスナゑソスソスワゑソスソスソス
ソスニ表ソスソスソスソスソスソス驍アソスニゑソスソスmソスFソスB


ソスソスソスIソスソスソスfソス}ソスソスソスhソスzソスMソスmソスF

ソスiソスPソスjソスソスソスソスマ奇ソスソスXソスNソスソスソスvソスgソス成
[root@centos ~]# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpmソス@ソスソスソス@nux-dextopソスソスソス|ソスWソスgソスソスソスCソスソスソスXソスgソス[ソスソス

[root@centos ~]# yum -y install ffmpegソス@ソスソスソス@ffmpegソスCソスソスソスXソスgソス[ソスソス

[root@centos ~]# vi convert_to_hls.shソス@ソスソスソス@HLSソス`ソスソスソスソスソスソスマ奇ソスソスXソスNソスソスソスvソスgソス成
#!/bin/bash
FILENAME=`basename ${1} | sed 's/\.[^\.]*$//'`
ffmpeg -re -i ${1} -vcodec libx264 -vprofile baseline -acodec copy -ar 44100 -ac 1 -f segment -segment_format mpegts -segment_time 10 -segment_list ${FILENAME}.m3u8 ${FILENAME}-%03d.ts
if [ $? -eq 0 ]; then
    echo "convert completed. => ${FILENAME}.m3u8"
else
    echo "convert failed."
fi

ソスiソスQソスjソスソスソスソスソスHLSソス`ソスソスソスノ変奇ソス
ソスマ奇ソスソスソスソスソスソスソスソスWinSCPソスナ難ソスソスソスiソス[ソスソスi/usr/local/nginx/html/vodソスjソスヨ格ソス[ソスソスソスソスB
[root@centos ~]# cd /usr/local/nginx/html/vodソス@ソスソスソス@ソスソスソスソスiソス[ソスソスfソスBソスソスソスNソスgソスソスソスヨ移難ソス

[root@centos vod]# sh /root/convert_to_hls.sh ソスマ奇ソスソスソスソスソスソスソスtソス@ソスCソスソスソスソスソス@ソスソスソス@HLSソス`ソスソスソスソスソスソスマ奇ソス
ソスE
ソスE
ソスE
convert completed. => xxxxxxxx.m3u8ソス@ソスソスソス@ソスソスソスソスマ奇ソスソスソスソスソス

[root@centos vod]# cdソス@ソスソスソス@ソスソスソスソスiソス[ソスソスfソスBソスソスソスNソスgソスソスソス抜ゑソスソスソス

ソスiソスRソスjソスソスソス謗具ソスソスソスpソスyソス[ソスWソス成
[root@centos ~]# vi /usr/local/nginx/html/vod.htmlソス@ソスソスソス@ソスソスソス謗具ソスソスソスpソスyソス[ソスWソス成
<!DOCTYPE html>
<html lang="en" class="">
<head>
    <title>ONDEMAND</title>
    <link href="//vjs.zencdn.net/5.11/video-js.min.css" rel="stylesheet">
    <script src="//cdn.jsdelivr.net/hls.js/latest/hls.min.js"></script>
    
</head>
<body>
<video id="video" class="video-js vjs-default-skin" width="640" height="480" controls>
<script type="text/javascript">
    var source = '/vod/ソスソスソスソスtソス@ソスCソスソスソスソス.m3u8';
    var ua = navigator.userAgent;
    if (ua.indexOf('iPhone') > 0 || ua.indexOf('iPad') > 0 || ua.indexOf('Android') > 0) {
        // iOS
        document.write('<source src=' + source + ' type="application/x-mpegURL">');
        document.write('</video>');

    }else{
        // OTHER
        document.write('</video>');
        if(Hls.isSupported()) {
            var video = document.getElementById('video');
            var hls = new Hls();
            hls.loadSource(source);
            hls.attachMedia(video);
            hls.on(Hls.Events.MANIFEST_PARSED,function() {
                video.play();
            });
        }
    }
</script>
</body>
</html>

ソスソスPCソスuソスソスソスEソスUソスソスソスソスhttp://ソスTソス[ソスoソス[ソスソス:8080/vod.htmlソスヨアソスNソスZソスXソスソスソスト難ソスソス謔ェソスソスソスソスソスナゑソスソス驍アソスソス
ソスソスiPhoneソスワゑソスソスソスiPadソスソスソスソスhttp://ソスTソス[ソスoソス[ソスソス:8080/vod.htmlソスヨアソスNソスZソスXソスソスソスト難ソスソス謔ェソスソスソスソスソスナゑソスソス驍アソスソス


ソスソスソスソスソスCソスuソスzソスMソスmソスF

ソスyPCソスソスソスソスzソスMソスソスソスソス鼾ソスz

ソスiソスPソスjFlash Media Live EncoderソスCソスソスソスXソスgソス[ソスソス
Flash Media Live EncoderソスソスソスgソスpソスソスソストカソスソスソスソスソスfソスソスソスEソスソスソスソスソスソスソスTソス[ソスoソス[ソスヨ托ソスソスMソスソスソス驍スソス゚、ソスJソスソスソスソスソスソスレ托ソスソスソスソスソス[ソスソスソスソスFlash Media Live Encoderソスソスソス_ソスEソスソスソスソスソス[ソスhソスソスソストイソスソスソスXソスgソス[ソスソス

ソスiソスQソスjソスソスソスCソスuソスzソスM
Flash Media Live EncoderソスソスソスNソスソス

ソスuEncoding Optionsソスvソス^ソスuソスソスIソスソス

ソスyソスソスハ搾ソスソスソスソスz
ソスuPresetソスvソスナ「High Bandwidthソスi800Kbpsソスj-H.264ソスvソスソスIソスソス

ソスuFormatソスvソスフソスソスソスソス`ソス{ソス^ソスソスソスソスソスソスソスソスソスソスソスト「Advanced Encoder Settingsソスvソス_ソスCソスAソスソスソスOソス{ソスbソスNソスXソスフ「Keyframe Frequencyソスvソスナ「4 SecondsソスvソスソスIソスソス

ソスyソスソスハ右ソスソスソスz
ソスuFMS URLソスvソスソス"rtmp://ソスTソス[ソスoソス[IPソスAソスhソスソスソスX/live"ソスニ難ソスソスソスソスソスソスソスソスLソスソス"live"ソスヘアソスvソスソスソスPソス[ソスVソスソスソスソスソスソスソスinginx.confソスソスapplicationソスナ指ソス閧オソスソスソスlソスjソスソスソスwソスソス

ソスuStreamソスvソスソス"live"ソスニ難ソスソスソスソスソスソスソスソスLソスソス"live"ソスヘスソスgソスソスソス[ソスソスソスLソス[ソスiソスCソスモの値ソスjソスソスソスwソスソス

ソスuConnectソスvソス{ソス^ソスソスソスソスソスソス

ソスuStartソスvソス{ソス^ソスソスソスソスソスソス

ソスソスソスソスナサソス[ソスoソス[ソスノカソスソスソスソスソスfソスソスソスEソスソスソスソスソスフ托ソスソスMソスソスソスJソスnソスソスソスソスソスB


ソスyiPhoneソスソスソスソスzソスMソスソスソスソス鼾ソスz

ソスiソスPソスjLive:Air SoloソスCソスソスソスXソスgソス[ソスソス
iPhoneソスソスLive:Air SoloソスソスソスCソスソスソスXソスgソス[ソスソス


ソスiソスQソスjソスソスソスCソスuソスzソスM
Live:Air SoloソスソスソスNソスソス


ソスuCUSTOM RTMPソスvソスソスソス^ソスbソスv


ソスuURLソスvソスソス"rtmp://ソスTソス[ソスoソス[ソスソス/live"ソスAソスuStreamソスvソスソス"live"ソスニ難ソスソスヘゑソスソスト、ソスuAdd RTMPソスvソスソスソス^ソスbソスvソスソスソスソスソスLソスフ最擾ソスソスソス"live"ソスヘアソスvソスソスソスPソス[ソスVソスソスソスソスソスソスソスinginx.confソスソスapplicationソスナ指ソス閧オソスソスソスlソスjソスAソスソスソスソス"live"ソスヘスソスgソスソスソス[ソスソスソスLソス[ソスiソスCソスモの値ソスjソスソスソスwソスソス


ソスEソスヨスソスソスソスCソスvソスソスソスト「Add New Sourceソスvソスソスソス^ソスbソスv


ソスuiOS Cameraソスvソスソスソス^ソスbソスv


iOSソスJソスソスソスソスソスfソスソスソスソスソス^ソスbソスvソスソスソスト搾ソスソスヨスソスソスソスCソスv


ソスuGo Live!ソスvソスソスソス^ソスbソスv

ソスソスソスソスナサソス[ソスoソス[ソスノカソスソスソスソスソスfソスソスソスEソスソスソスソスソスフ托ソスソスMソスソスソスJソスnソスソスソスソスソスB

ソスiソスRソスjソスソスソスCソスuソスソスソス謗具ソスソスソスpソスyソス[ソスWソス成
[root@centos ~]# vi /usr/local/nginx/html/live.htmlソス@ソスソスソス@ソスソスソスCソスuソスソスソス謗具ソスソスソスpソスyソス[ソスWソス成
<!DOCTYPE html>
<html lang="en" class="">
<head>
    <title>LIVE</title>
    <link href="//vjs.zencdn.net/5.11/video-js.min.css" rel="stylesheet">
    <script src="//cdn.jsdelivr.net/hls.js/latest/hls.min.js"></script>
</head>
<body>
<video id="video" class="video-js vjs-default-skin" width="640" height="480" controls>
<script type="text/javascript">
    var source = '/HLS(HTTP Live Streaming)ソスtソス@ソスCソスソスソス成ソスソス/ソスAソスvソスソスソスPソス[ソスVソスソスソスソスソスソス.m3u8ソスiソスソス:/live/live.m3u8ソスj';
    var ua = navigator.userAgent;
    if (ua.indexOf('iPhone') > 0 || ua.indexOf('iPad') > 0 || ua.indexOf('Android') > 0) {
        // Mobile
        document.write('<source src=' + source + ' type="application/x-mpegURL">');
        document.write('</video>');
    }else{
        // OTHER
        document.write('</video>');
        if(Hls.isSupported()) {
            var video = document.getElementById('video');
            var hls = new Hls();
            hls.loadSource(source);
            hls.attachMedia(video);
            hls.on(Hls.Events.MANIFEST_PARSED,function() {
                video.play();
            });
        }
    }
</script>
</body>
</html>

ソスソスPCソスuソスソスソスEソスUソスソスソスソスhttp://ソスTソス[ソスoソス[ソスソス:8080/live.htmlソスヨアソスNソスZソスXソスソスソストカソスソスソスソスソスfソスソスソスEソスソスソスソスソスソスソスソスソスソスソスナゑソスソス驍アソスソス
ソスソスiPhoneソスワゑソスソスソスiPadソスソスソスソスhttp://ソスTソス[ソスoソス[ソスソス:8080/live.htmlソスヨアソスNソスZソスXソスソスソストカソスソスソスソスソスfソスソスソスEソスソスソスソスソスソスソスソスソスソスソスナゑソスソス驍アソスソス



ソスソスソスヨ連ソスRソスソスソスeソスソスソスc

<!ソス\ソスeソスLソスXソスgソスフみゑソス4ソスsソス\ソスソスソスノ追会ソスソスソスCソスソスソスソスソスソス\>



ソスソスソスソスソスフペソス[ソスWソスフトソスbソスvソスヨ戻ゑソス

ソスvソスソスソスCソスoソスVソス[ソス|ソスソスソスVソス[
centossrv.com