pretender1111 / FFmpegOutRTSP

在Unity中使用FFmpegOut插件,实现对摄像机画面进行RTSP推流的功能。同时,项目中包含了RTSP服务器程序,将电脑ip作为地址创建RTSP服务器。
7 stars 2 forks source link

unable to run properly #1

Open zxh945 opened 4 months ago

zxh945 commented 4 months ago

This is a very good project unable to run properly, I looked into the code but couldn't find the process from FFmpeg to rtsp-simple-server.
Also, there's an error: session == null

pretender1111 commented 4 months ago

I ran the program on my computer, and it worked fine. First, please make sure you have correctly set the encoder and RTSP address, which can be configured in the camera's inspector. The code at line 25 in the file "Assets/FFmpegOut/Runtime/RTSPServerLoader.cs" opens the rtsp-simple-server.exe, and its configuration file is located at "Assets/RTSPServer/rtsp-simple-server.yml". For the error "session == null," you need to check if the IP address entered in the inspector for the RTSP address matches the current IP address of your computer. Make sure you input it correctly. If you still have issues, please provide a more detailed description. For the first time uploading a project on GitHub, please excuse any shortcomings. Your understanding is greatly appreciated.

zxh945 commented 4 months ago

Wow, I am so happy to hear from you It seems like the path and parameters for ffmpeg are correct. However, it appears that the RTSPServer isn't picking up on ffmpeg's launch, which has been a persistent issue. I've tried starting the RTSPServer using this project, I've also manually started ffmpeg from the command line, and RTSPServer seems to work. 111

pretender1111 commented 4 months ago

I'm sorry that my understanding of RTSP and computer networks is not deep enough, so there may be some flaws in the code. It seems like your RTSPServer can work normally but cannot receive streams from ffmpeg. You can try modifying line 196 of CameraCapture.cs, removing 'isServerAccesible' from the if statement condition 'if (_session == null && loader.RTSPServerloaded && isServerAccesible)'. I added this condition to ensure that the program doesn't hang when the RTSP address is entered incorrectly. However, there seems to be an issue with obtaining the IP address, which may cause this condition to be false. I noticed that you have set the RTSP streaming address to 127.0.0.1 instead of the IP address of your computer network. This might be the reason why the aforementioned condition is not met. It seems that the rtsp-simple-server.exe plugin automatically sets the RTSP server address to the IP address of your computer network. Therefore, when setting the streaming address, you need to input the IP address of your computer network instead of 127.0.0.1. Additionally, the command statement for FFmpeg is set in "Assets\FFmpegOut\Runtime\FFmpegSession.cs".