[FFmpeg-user] How to you prevent ffmpeg from stopping when
Oliver Fromme
oliver at fromme.com
Sat Sep 14 19:11:39 EEST 2024
Dan Naughton wrote:
> ffmpeg mjpeg streaming is working (VLC tested as a client)
>
> This is the command:
> ffmpeg -stream_loop -1 -re -i file.mjpeg -an -c copy -listen 1 -f mpjpeg
> http://192.168.1.7:8080
>
> But when the client closed the connection - ffmpeg exits:
> [...]
> Is there some parameter I missed to keep the stream alive? (or is this
> pretty much normal)
>From what I can tell, the -listen option does not implement a full
multi-client network server. It only serves a single client and
then exits. So, yes, it is pretty much normal.
For simple use-cases, if you want to serve a file to a restricted
set of clients via HTTP, it's probably best to use a normal web
server, like Apache httpd or nginx, or use Python's web server
module if you're not afraid of writing a few lines of Python code.
There's no need to involve FFmpeg at all, unless you want to
transcode the file on the fly. In this case you should take the
performance implications into account when multiple clients request
the file at the same time.
Best regards
-- Oliver
More information about the ffmpeg-user
mailing list