bluenviron / mediamtx

Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.
MIT License
10.71k stars 1.4k forks source link

Connection to tcp://localhost:8554?timeout=0 failed: Connection refused #3348

Closed picarica closed 2 days ago

picarica commented 1 month ago

Which version are you using?

v1.8.1

Which operating system are you using?

Describe the issue

i am unable to publish stream i tried anything publishing webcam stream or even mp4 file

echo testing | nc localhost 8554
localhost [127.0.0.1] 8554 (?) : Connection refused

i even have this error

Describe how to replicate the issue

  1. start the server
  2. i published it with ffmpeg -f v4l2 -input_format yuyv422 -i /dev/video0 -f alsa -i plughw:CARD=HD,DEV=0 -c:v libx264 -preset fast -tune zerolatency -c:a aac -b:a 128k -strict experimental -vf "format=yuv420p" -f rtsp rtsp://localhost:8554/room even tried ffmpeg -re -stream_loop -1 -i landyard.mp4 -f rtsp -rtsp_transport tcp rtsp://localhost:8554/live both have same error

Did you attach the server logs?

ffmpeg -f v4l2 -input_format yuyv422 -i /dev/video0 -f alsa -i plughw:CARD=HD,DEV=0 -c:v libx264 -preset fast -tune zerolatency -c:a aac -b:a 128k -strict experimental -vf "format=yuv420p" -f rtsp rtsp://localhost:8554/room
ffmpeg version 5.1.4-0+deb12u1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr --extra-version=0+deb12u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 307.373203, bitrate: 110592 kb/s
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x360, 110592 kb/s, 30 fps, 30 tbr, 1000k tbn
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'plughw:CARD=HD,DEV=0':
  Duration: N/A, start: 1715591679.396483, bitrate: 1536 kb/s
  Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x5574ae5e1580] using cpu capabilities: MMX2 SSE2 SSE3 Cache64
[libx264 @ 0x5574ae5e1580] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x5574ae5e1580] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=5 lookahead_threads=5 sliced_threads=1 slices=5 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[alsa @ 0x5574ae5cb900] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[tcp @ 0x5574ae83a840] Connection to tcp://localhost:8554?timeout=0 failed: Connection refused
Could not write header for output file #0 (incorrect codec parameters ?): Connection refused
Error initializing output stream 0:1 -- 
[libx264 @ 0x5574ae5e1580] frame I:1     Avg QP: 5.00  size:   324
[libx264 @ 0x5574ae5e1580] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0x5574ae5e1580] 8x8 transform intra:0.0%
[libx264 @ 0x5574ae5e1580] coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0%
[libx264 @ 0x5574ae5e1580] i16 v,h,dc,p: 78%  0% 22%  0%
[libx264 @ 0x5574ae5e1580] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 0x5574ae5e1580] kb/s:77.76
[aac @ 0x5574ae5e2bc0] Qavg: nan
Conversion failed!

Did you attach a network dump?

yes


    1 0.000000000          ::1 → ::1          TCP 94 41396 → 8554 [SYN] Seq=0 Win=65476 Len=0 MSS=65476 SACK_PERM TSval=3522177150 TSecr=0 WS=64
    2 0.000014302          ::1 → ::1          TCP 74 8554 → 41396 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
    3 0.000077763    127.0.0.1 → 127.0.0.1    TCP 74 37698 → 8554 [SYN] Seq=0 Win=65495 Len=0 MSS=65495 SACK_PERM TSval=1743146916 TSecr=0 WS=64
    4 0.000087871    127.0.0.1 → 127.0.0.1    TCP 54 8554 → 37698 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0

it only captured these

picarica commented 1 month ago

i thought it was was issue how vms are handled in truenas (this was from from one) i opened forum thread also in that forum with no answer, whats going on. https://forums.truenas.com/t/unable-to-publish-rtsp-stream-from-virtualmachine-connection-refused/4265

aler9 commented 2 days ago

Hello, from the data you provided, it looks like the server has not been started at all. If you still have problems, open another issue and provide logs of the server, not FFmpeg's.