Knowledge Base
Using FFmpeg in listen mode to make it a stand-alone RTMP server
You can have FFmpeg run in listen mode and make it behave like a stand-alone RTMP live-stream server. In this article you can find some examples on how to accomplish this.
ffmpeg -f flv -listen 1 -i rtmp://localhost:1935/live/app -c copy rtsp://YOUR_RTSP_HOST
-listen 1
makes FFmpeg act as a RTMP server when used with RTMP protocol.- Use
rtmp://localhost:1935/live/app
as the RTMP server url on the source. - You can set any playpath
rtmp://localhost:1935/any/thing
and any port. - The main advantage with this way is simplicity, the disadvantage is server stops if source stopped or had encoding errors.
- The other option is to use nginx with nginx-rtmp-module.
For example the following command will generate a signal, and will stream it to the port 1234 on localhost:
ffmpeg -re -f lavfi -i aevalsrc="sin(400*2*PI*t)" -ar 8000 -f mulaw -f rtp rtp://127.0.0.1:1234
To play the stream with ffplay (which has some caveats, see above), run the command:
ffplay rtp://127.0.0.1:1234
Note that TP by default uses UDP, which, for large streams, can cause packet loss.
![](https://livestream.puntenel.nl/wp-content/uploads/sites/14/2021/02/ffmpegbanner.jpg)