网络上很多问文章介绍使用ffmpeg推送和拉流,经常遗漏安装rtsp-simple-server的步骤,执行推流命令:
D:\software\ffmpeg-7.0.1-full_build\bin\ffmpeg.exe -re -stream_loop -1 -i "D:\Video\汪汪队立大功\S07\001.mp4" -vcodec h264 -acodec aac -f flv rtmp://127.0.0.1/live/test110
会出现如下报错:
[tcp @ 00000256cd34b3c0] Connection to tcp://127.0.0.1:1935?tcp_nodelay=0 failed: Error number -138 occurred
[rtmp @ 00000256cd3cd340] Cannot open connection tcp://127.0.0.1:1935?tcp_nodelay=0
找到一个比较完整的过程的介绍文章:
基于FFmpeg进行rtsp推流及拉流(详细教程)_ffmpeg推流-CSDN博客
补齐了启动rtsp-server过程,执行mediamtx.exe 作为 rtsp-simple-server,遇到如下问题:
1. 遇到报错
D:\software\mediamtx_v1.8.3_windows_amd64>mediamtx.exe
2024/06/20 11:35:41 INF MediaMTX v1.8.3
2024/06/20 11:35:41 INF configuration loaded from D:\software\mediamtx_v1.8.3_windows_amd64\mediamtx.yml
2024/06/20 11:35:41 INF [RTSP] listener opened on :8554 (TCP), :8000 (UDP/RTP), :8001 (UDP/RTCP)
2024/06/20 11:35:41 ERR listen tcp :1935: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
2024/06/20 11:35:41 INF [RTSP] listener is closing
2024/06/20 11:35:41 INF waiting for running hooks
解决方法:
启动windows power shell后,执行:
sc stop winnat
sc start winnat
sc相关介绍:SC命令一键搞定
————————————————