安装ffmpeg
下载地址:https://github.com/BtbN/FFmpeg-Builds/releases
安装:下载对应系统安装包,解压缩。
配置环境:在环境变量的path中添加ffmpeg的bin目录路径
D:\ware\ffmpeg-master-latest-win64-gpl\ffmpeg-master-latest-win64-gpl\bin
验证是否安装成功:
出现以下则证明安装成功
进行转换:
该步骤在配置nginx.conf文件之后执行。
ffmpeg -rtsp_transport udp -i "rtsp://127.0.0.1:8557/h3" -fflags flush_packets -max_delay 1 -an -flags -global_header -hls_time 1 -hls_list_size 2 -hls_flags 2 -vcodec copy -s 216x384 -b 1024k -y D:/ware/nginx-1.22.0/html/channel101.m3u8
执行出现以下则运行成功:
安装nginx(略)
配置nginx.conf
添加配置信息
server {
listen 8097;
location /hls {
types{
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root html;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
}
通过VLC视频播放器访问网络地址
http://127.0.0.1:8097/channel101.m3u8