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
11.64k stars 1.47k forks source link

rtsp://127.0.0.1:8554/stream: Server returned 404 Not Found #1439

Closed aishangcengloua closed 1 year ago

aishangcengloua commented 1 year ago

Which version are you using?

v0.21.2

Which operating system are you using?

Describe the issue

I have used ffmpeg -re -i test.mp4 -c copy -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/stream to push the video to rtsp.

When I attemp to run FFmpeg streaming commands(ffmpeg -i rtsp://127.0.0.1:8554/stream -c copy output.mp4 or ffplay rtsp://127.0.0.1:8554/stream), FFmpeg crashes with error:

[rtsp @ 00000252a644a180] method DESCRIBE failed: 404 Not Found/0
rtsp://127.0.0.1:8554/stream: Server returned 404 Not Found

Describe how to replicate the issue

  1. start the server
  2. publish with ffmpeg -re -i test.mp4 -c copy -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/stream in PowerShell
  3. read with ffplay rtsp://127.0.0.1:8554/stream
  4. erro: rtsp://127.0.0.1:8554/stream: Server returned 404 Not Found
  5. done

Did you attach the server logs?

2023/02/02 17:14:13 INF [RTSP] [session 81fd9847] created by 127.0.0.1:58913
2023/02/02 17:14:13 INF [RTSP] [session 81fd9847] is publishing to path 'stream', with TCP, 2 tracks (H264, MPEG4-audio)
2023/02/02 17:14:22 INF [RTSP] [session 81fd9847] destroyed (teared down by 127.0.0.1:58913)
2023/02/02 17:14:22 INF [RTSP] [conn 127.0.0.1:58913] closed (read tcp 127.0.0.1:8554->127.0.0.1:58913: wsarecv: An established connection was aborted by the software in your host machine.)

Did you attach a network dump?

no

jandersonai commented 1 year ago

Happening to me on 0.21.2 as well. All of my paths return 404 including HLS paths.

aishangcengloua commented 1 year ago

Happening to me on 0.21.2 as well. All of my paths return 404 including HLS paths.

Is your problem solved?

aler9 commented 1 year ago

Hello, in the logs you posted there's no sign of ffplay connecting to the server. Are you sure that ffplay is correctly able to connect to the server? are you sure that ffmpeg is still publishing the video before ffplay connects to the server? please post the full ffmpeg and server logs.

aishangcengloua commented 1 year ago

Hello, in the logs you posted there's no sign of ffplay connecting to the server. Are you sure that ffplay is correctly able to connect to the server? are you sure that ffmpeg is still publishing the video before ffplay connects to the server? please post the full ffmpeg and server logs.

The full ffmpeg and server logs as follows: ffmpeg:

F:\AI_Edge_Compute>ffmpeg -re -i input.mp4 -c copy -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/stream
ffmpeg version 5.0.1-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:00:08.73, start: 0.000000, bitrate: 1434 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/smpte170m, progressive), 432x960, 1378 kb/s, 30 fps, 30 tbr, 90k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 48 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Output #0, rtsp, to 'rtsp://127.0.0.1:8554/stream':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.16.100
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/smpte170m, progressive), 432x960, q=2-31, 1378 kb/s, 30 fps, 30 tbr, 90k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 48 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  262 fps= 30 q=-1.0 Lsize=N/A time=00:00:08.66 bitrate=N/A speed=   1x
video:1470kB audio:51kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

server:

2023/02/05 12:32:44 INF [RTSP] [conn 127.0.0.1:51153] opened
2023/02/05 12:32:44 INF [RTSP] [session e88006de] created by 127.0.0.1:51153
2023/02/05 12:32:44 INF [RTSP] [session e88006de] is publishing to path 'stream', with TCP, 2 tracks (H264, MPEG4-audio)
2023/02/05 12:32:52 INF [RTSP] [session e88006de] destroyed (teared down by 127.0.0.1:51153)
2023/02/05 12:32:52 INF [RTSP] [conn 127.0.0.1:51153] closed (read tcp 127.0.0.1:8554->127.0.0.1:51153: wsarecv: An established connection was aborted by the software in your host machine.)

ffmpeg:

F:\AI_Edge_Compute>ffplay rtsp://127.0.0.1:8554/stream
ffplay version 5.0.1-essentials_build-www.gyan.dev Copyright (c) 2003-2022 the FFmpeg developers
  built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
[rtsp @ 000001f4edc4a4c0] method DESCRIBE failed: 404 Not Found/0
rtsp://127.0.0.1:8554/stream: Server returned 404 Not Found

server:

2023/02/05 12:33:11 INF [RTSP] [conn 127.0.0.1:51154] opened
2023/02/05 12:33:11 INF [RTSP] [conn 127.0.0.1:51154] closed (no one is publishing to path 'stream')

Is this caused by problems with the stability of my device or the server?

aler9 commented 1 year ago

In the log you posted, connection between the FFmpeg instance that is publishing the stream and the server gets closed after 8 seconds, and therefore the stream is not available for reading.

Probably 8 seconds is the duration of your video file. If you want to make FFmpeg continue publishing the video stream indefinitely, you have to use the -stream_loop -1 flag:

ffmpeg -stream_loop -1 -re -i input.mp4 -c copy -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/stream
github-actions[bot] commented 7 months ago

This issue is being locked automatically because it has been closed for more than 6 months. Please open a new issue in case you encounter a similar problem.