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

Play other path if stream not ready or publisher dissconnected #3333

Closed mohsundiod closed 2 weeks ago

mohsundiod commented 1 month ago

Describe the feature

media server play default file in loop (mp4 or jpeg or other path) if publisher is not ready.

eravellaSC commented 1 month ago

Have you tried using the runOnNotReady hook in combination with ffmpeg to stream a file?

mohsundiod commented 1 month ago

tanx, runOnNotReady do it with this config:

paths:
  udp:
    source: udp://238.0.0.1:1234

    runOnReady: ./ffmpeg.exe -i rtsp://localhost:$RTSP_PORT/$MTX_PATH -c:v copy -c:a copy -f rtsp -rtsp_transport tcp rtsp://localhost:$RTSP_PORT/live
    runOnReadyRestart: no

    runOnNotReady: ./ffmpeg.exe -re -f lavfi -i testsrc=size=1280x720:rate=30 -pix_fmt yuv420p -c:v libx264 -preset ultrafast -b:v 600k -f rtsp -rtsp_transport tcp rtsp://localhost:$RTSP_PORT/live

  live:

Problem: the client dissconnect from server. can switch stream on the fly?

eravellaSC commented 1 month ago

Again, you can use a hook: I think runOnDisconnect is what you are looking for.

kaitlynia commented 3 weeks ago

For posterity, as long as #3372 is open this issue is not solvable

aler9 commented 2 weeks ago

This issue is a duplicate of #2214.

For posterity, as long as https://github.com/bluenviron/mediamtx/issues/3372 is open this issue is not solvable

This other issue is completely unrelated from this and is invalid.