Using FFmpeg in listen mode to make it a stand-alone RTMP server

7 February 2021

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.

Table of Contents

Leave a Reply

Your email address will not be published. Required fields are marked *

Similar Content

23 January 2021
Introduction to the new how-to article in the Knowledge Base.

I wrote a new guide on setting up your own live-stream server. Mostly due to your requests. I took the opportunity to simplify and shorten the guide a bit. If you follow this guide step by step, and use your brain a tiny bit, you'll be fine. This guide has so far been tested on […]

× Read More ×
19 June 2025
Choosing the live-stream host that suits your needs

Discover how to choose the right live-stream host for your organization. Compare popular platforms like DaCast, Wowza, Vimeo, Kick, ReStream and IBM.

× Read More ×
Copyright © 2025. 
All rights reserved.