Centos8安装ffmpeg,使用mediamtx搭建RTSP流媒体服务器

1、Centos安装ffmpeg

  • 1、先安装epel-release

    yum install epel-release
    
  • 2、安装nux存储库

    rpm -v --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
    rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
    
  • 3、安装ffmpeg

    yum install ffmpeg ffmpeg-devel
    
  • 4、测试版本

    ffmpeg -version
    

    可以看到成功安装了在这里插入图片描述

2、使用mediamtx搭建媒体服务器

  • 官方下载Linux版本
    地址
    在这里插入图片描述

  • 解压后上传
    在这里插入图片描述

  • 进入指定目录并且运行

搭建本地rtsp服务器:
./mediamtx

拷贝流到本地服务器(windows)
ffmpeg -re -stream_loop -1 -i rstp.mp4 -c copy -f rtsp rtsp://localhost:8554/mystream

(Centos8)
ffmpeg -re -i rstp.mp4 -c copy -f rtsp rtsp://localhost:8554/mystream



保存流到文件:
ffmpeg -rtsp_transport tcp -i rtsp://localhost:8554/mystream -c copy -f mp4 output0602-2.mp4

VLC播放本地流

打开网络串流:
rtsp://localhost:8554/mystream

在这里插入图片描述

防火墙端口记得放

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_33957603/article/details/130806671
今日推荐