TCP connection refused when using ffserver / ffmpeg

Mike picture Mike · Aug 24, 2011 · Viewed 34.9k times · Source

I am getting a "TCP connection to localhost:8090 failed: Connection refused" error when trying to use ffserver on Ubuntu 10.04LTS Desktop.

I am typing:

ffmpeg -f video4linux2 -s 640x480 -r 30000/1001 -i /dev/video0 -f avi -vcodec mjpeg -r 30000/1001 http://localhost:8090/feed1.ffm

Here is the full output:

Input #0, video4linux2, from '/dev/video0':  
Duration: N/A, start: 1314207657.841770, bitrate: N/A  
   Stream #0.0: Video: mjpeg, yuvj420p, 1280x720 [SAR 96:96 DAR 16:9], -5 kb/s, 30 tbr, 1000k tbn, 30 tbc  
[tcp @ 0x9e58980] TCP connection to localhost:8090 failed: Connection refused  
[buffer @ 0x9e58260] w:1280 h:720 pixfmt:yuvj420p tb:1/1000000 sar:96/96 sws_param:  
Output #0, avi, to 'http://localhost:8090/feed1.ffm':  
  Metadata:  
    ISFT            : Lavf53.8.0  
    Stream #0.0: Video: mjpeg, yuvj420p, 1280x720 [SAR 96:96 DAR 16:9], q=2-31, 200 kb/s, 29.97 tbn, 29.97 tbc  
Stream mapping:  
  Stream #0.0 -> #0.0`  

ffserver seems to acknowledge the request though:

Wed Aug 24 13:40:57 2011 127.0.0.1 - - [POST] "/feed1.ffm HTTP/1.1" 200 1356  

Where is the problem? How can I use ffmpeg correctly?

Answer

ierdna picture ierdna · Dec 20, 2012

I was having the same issue, here's what worked for me:

in the /etc/ffserver.conf file put:

BindAddress 0.0.0.0

then in the <feed></feed> section add:

ACL allow 127.0.0.1
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255

assuming your network ip is 192.168.x.x

then start your server:

ffserver -d -f /etc/ffserver.conf