hls URLを使用してストリームを開くことができないのはなぜですか?

hls URLを使用してストリームを開くことができないのはなぜですか?

公式のnginxマニュアルに従って、ローカルコンピュータにRTMPサーバーを設定しました。
nginxを使用した遠隔学習用ビデオストリーミング

私のnginx設定:

sudo vim /usr/local/nginx/conf/nginx.conf    
worker_processes  1;   
error_log  logs/error.log;
worker_rlimit_nofile 8192;

events {
  worker_connections  1024;  
}  

rtmp { 
    server { 
        listen 1935; 
        application live { 
            live on; 
            interleave on;
 
            hls on; 
            hls_path /mnt/hls; 
            hls_fragment 15s; 
        } 
    } 
} 
 
http { 
    default_type application/octet-stream;
 
    server { 
        listen 80; 
        location /tv { 
            root /mnt/hls; 
        } 
    }
 
    types {
        application/vnd.apple.mpegurl m3u8;
        video/mp2t ts;
        text/html html;
    } 
}

RTMP URL設定:

output="rtmp://127.0.0.1:1935/live/sample"  

ウェブカメラの宣伝:

ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -c:v libx264 -f flv $output

rtmp プロトコルを使用してストリームを取得します。

ffplay rtmp://127.0.0.1:1935/live/sample

映像を正常に受け取りました。

hls プロトコルを使用してストリームを取得します。

ffplay http://127.0.0.1/live/sample
HTTP error 404 Not Found
http://127.0.0.1:80/live/sample.m3u8: Server returned 404 Not Found 
#It can't get video with browser.

どうすれば修正できますか? httpセグメントの次のコードスニペットはどういう意味ですか?

    server { 
        listen 80; 
        location /tv { 
            root /mnt/hls; 
        } 
    }

私はどこに行くべきですかmkdir /tv

ベストアンサー1

変化

hls_path /mnt/hls;

到着

hls_path /mnt/hls/tv;

ストリームは次のとおりです。http://127.0.0.1/tv/sample.m3u8

おすすめ記事