在日常开发中,有些时候需要做一些推拉流测试,但又找不到可以测试的拉流地址,这个时候,可以使用rtsp-simple-server来搭建rtsp/rtmp/HLS服务器。

1. 服务器搭建

rstp-simple-server支持各种操作系统,下载地址为:https://github.com/aler9/rtsp-simple-server/releases

以Windows为例,下载解压之后有下面这三个文件:

其中rtsp-simple-server.yml是一些配置,双击rstp-simple-server.exe启动服务器:

2. 推流测试

  • rtsp 推流:
ffmpeg -re -stream_loop -1 -i test.mp4 -c copy -f rtsp rtsp://localhost:8554/stream0

推流之后可以用VLC测试拉流:rtsp://localhost:8554/stream0

  • rtmp 推流:
ffmpeg -re -stream_loop -1 -i test.mp4 -c copy -f flv rtmp://localhost:1935/stream0

推流之后可以用VLC测试拉流:rtmp://localhost:1935/stream0

posted on 2023-02-18 10:37  $$X$$  阅读(1559)  评论(0)    收藏  举报