I build RTMP server on my local pc according to the nginx official manual:
video-streaming-for-remote-learning-with-nginx
My nginx setting:
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;
}
}
Set the rtmp url:
output="rtmp://127.0.0.1:1935/live/sample"
Push the web camera :
ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -c:v libx264 -f flv $output
Pull the stream with rtmp protocol:
ffplay rtmp://127.0.0.1:1935/live/sample
I get the video successfully.
Pull the stream with hls protocol:
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.
How to fix it?
What does the following code snippet in http segment mean?
server {
listen 80;
location /tv {
root /mnt/hls;
}
}
Where should i
mkdir /tv
?
Asked by scrapy
(353 rep)
Jan 12, 2021, 01:25 AM
Last activity: Jan 15, 2021, 10:09 AM
Last activity: Jan 15, 2021, 10:09 AM