<p>Try to use static build of ffmpeg without librtmp. You can download it from the website, or build by yourself. I've got the same problem, but without this lib I could run ffmpeg listener. Also when I tried to stream to external rtmp host, I've got issue when streaming unexpectedly stop. As described in the end of this ticket <a href="https://trac.ffmpeg.org/ticket/7547" rel="nofollow noreferrer">https://trac.ffmpeg.org/ticket/7547</a></p>

CC BY-SA 4.0
2020-09-16T09:31:22.380Z
2020-09-16T09:31:22.380Z
Dmitriy Chornenkiy
<p>Im trying to convert rtmp into an HLS stream using ffmpeg as the rtmp server. In the docs they mention that providing <code>-listen 1</code> makes ffmpeg act as an rtmp server yet the behaviour is very weird.</p>
<p>Example's I've tried (hls part changed to mp4 for readability):</p>
<pre><code>ffmpeg -listen 1 -f flv -i rtmp://localhost:1935/live/appname -c copy -f mp4
ffmpeg -listen 1 -f mpegts -i rtmp://localhost:1935/live/appname -c copy -f mp4
</code></pre>
<p>All give me the following error:</p>
<pre><code>RTMP_Connect0, failed to connect socket. 61 (Connection refused)
rtmp://127.0.0.1:1935/live/app: Unknown error occurred
</code></pre>
<p>What does work for me is when I change rtmp into tcp and vice versa in OBS for a test stream; however I actually doubt its then using rtmp as its underlying protocol.</p>
<p>Are there certain flags I have to enable during compilation of ffmpeg? My version has librtmp enabled. I'm not entirely sure what I'm doing wrong here but it looks like ffmpeg is still going into client mode even though I specified the listen flag.</p>
<p>Some other details:
I have tried with different outputs as well; with no luck, different placements of listen etc.</p>

<ffmpeg><rtmp>
FFmpeg rtmp listen not working correctly: Connection Refused
Antwan van Houdt
# FFmpeg rtmp listen not working correctly: Connection Refused

(Asked by: username_0 on 2020-08-11)

Im trying to convert rtmp into an HLS stream using ffmpeg as the rtmp server. In the docs they mention that providing -listen 1 makes ffmpeg act as an rtmp server yet the behaviour is very weird.
Example's I've tried (hls part changed to mp4 for readability):
ffmpeg -listen 1 -f flv -i rtmp://localhost:1935/live/appname -c copy -f mp4
ffmpeg -listen 1 -f mpegts -i rtmp://localhost:1935/live/appname -c copy -f mp4

All give me the following error:
RTMP_Connect0, failed to connect socket. 61 (Connection refused)
rtmp://127.0.0.1:1935/live/app: Unknown error occurred

What does work for me is when I change rtmp into tcp and vice versa in OBS for a test stream; however I actually doubt its then using rtmp as its underlying protocol.
Are there certain flags I have to enable during compilation of ffmpeg? My version has librtmp enabled. I'm not entirely sure what I'm doing wrong here but it looks like ffmpeg is still going into client mode even though I specified the listen flag.
Some other details:
I have tried with different outputs as well; with no luck, different placements of listen etc.

**Tags:** ffmpeg, rtmp


---

## 1 answers

### Answer by username_1 on 2020-09-16. Score: 1

Try to use static build of ffmpeg without librtmp. You can download it from the website, or build by yourself. I've got the same problem, but without this lib I could run ffmpeg listener. Also when I tried to stream to external rtmp host, I've got issue when streaming unexpectedly stop. As described in the end of this ticket <https://trac.ffmpeg.org/ticket/7547>


---

