Http Listen Connection Drop

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Http Listen Connection Drop

sirk98 qwerty89
Hello dear forum,

I try to setup FFmpeg + http listen option to serve some live stream
without web server .
If I run the script seems that all is working fine .
But if client close connection, ffmpeg stops and I need to restart script .
What I can do to solve this problem ?

Here my script :

./ffmpeg -fflags +genpts -nostats -nostdin -hide_banner -loglevel quiet -i '
http://live.stream.net/stream/channel/1'  -strict experimental -listen 1 -f
mpegts 'http://192.168.1.110:9300

I try also to add multiple requests option but I can't solve the problem :

./ffmpeg -fflags +genpts -nostats -nostdin -hide_banner -loglevel quiet -i '
http://live.stream.net/stream/channel/1'  -strict experimental -listen 1
-multiple_requests -f mpegts 'http://192.168.1.110:9300
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Http Listen Connection Drop

John Smith-2
> I try to setup FFmpeg + http listen option to serve some live stream
> without web server .
> If I run the script seems that all is working fine .
> But if client close connection, ffmpeg stops and I need to restart script .
> What I can do to solve this problem ?
>
>
What I do is use ffmpeg to stream the connection to an nginx web server;
the nginx server handles the clients, ffmpeg feeds nginx with the live
stream.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Http Listen Connection Drop

sirk98 qwerty89
Hello,
Thx for your reply, can u write an example?
Do you use nginx with a proxy_pass rule?
Or how?



Il Mar 8 Mag 2018, 18:53 John Smith <[hidden email]> ha scritto:

> > I try to setup FFmpeg + http listen option to serve some live stream
> > without web server .
> > If I run the script seems that all is working fine .
> > But if client close connection, ffmpeg stops and I need to restart
> script .
> > What I can do to solve this problem ?
> >
> >
> What I do is use ffmpeg to stream the connection to an nginx web server;
> the nginx server handles the clients, ffmpeg feeds nginx with the live
> stream.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Http Listen Connection Drop

Nicolas George
In reply to this post by sirk98 qwerty89
sirk98 qwerty89 (2018-05-07):
> I try to setup FFmpeg + http listen option to serve some live stream
> without web server .
> If I run the script seems that all is working fine .
> But if client close connection, ffmpeg stops and I need to restart script .
> What I can do to solve this problem ?

The first step would be to peruse the diagnostics printed or otherwise
available (especially the return code of the process) to know the exact
cause of the crash. If you have trouble understanding them by yourself,
do not hesitate to post them fully here.

Regards,

--
  Nicolas George

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Http Listen Connection Drop

sirk98 qwerty89
I try to use the debug loglevel, but I can't understand the problem .

av_interleaved_write_frame(): Broken pipe
No more output streams to write to, finishing.
Error writing trailer of http://127.0.0.1:8989/1: Broken pipe

This error appears when client press Stop on the stream . I need that the
connection remains open for other client . I try to use nginx as proxy
server using the proxy pass option, but the problem is the same .

What I can do ?

2018-05-11 11:27 GMT+02:00 Nicolas George <[hidden email]>:

> sirk98 qwerty89 (2018-05-07):
> > I try to setup FFmpeg + http listen option to serve some live stream
> > without web server .
> > If I run the script seems that all is working fine .
> > But if client close connection, ffmpeg stops and I need to restart
> script .
> > What I can do to solve this problem ?
>
> The first step would be to peruse the diagnostics printed or otherwise
> available (especially the return code of the process) to know the exact
> cause of the crash. If you have trouble understanding them by yourself,
> do not hesitate to post them fully here.
>
> Regards,
>
> --
>   Nicolas George
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Http Listen Connection Drop

Moritz Barsnick
On Mon, May 14, 2018 at 12:54:02 +0200, sirk98 qwerty89 wrote:

> I try to use the debug loglevel, but I can't understand the problem .
>
> av_interleaved_write_frame(): Broken pipe
> No more output streams to write to, finishing.
> Error writing trailer of http://127.0.0.1:8989/1: Broken pipe
>
> This error appears when client press Stop on the stream . I need that the
> connection remains open for other client . I try to use nginx as proxy
> server using the proxy pass option, but the problem is the same .
>
> What I can do ?

May I interrupt this discussion and put forward the theory that the
"listen" mode of ffmpeg's http protocol/muxer was not made for multiple
connections? As far as I understand, it waits for one connection, and
terminates once this connection is closed.

The option "-multiple_requests" does persistant HTTP connections for
other sub-protocols, and has nothing to do with some sort of "server"
mode.

What you are trying to achieve was once provided by ffserver (until it
was recently discontinued).

nginx might be one option, and I once heard of an ffmpeg based server
similar to ffserver which serves only Matroska via HTTP, but I can't
find the link.

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Http Listen Connection Drop

Nicolas George
Moritz Barsnick (2018-05-14):
> May I interrupt this discussion and put forward the theory that the
> "listen" mode of ffmpeg's http protocol/muxer was not made for multiple
> connections? As far as I understand, it waits for one connection, and
> terminates once this connection is closed.

That is not the exact explanation but close enough.

The HTTP protocol can handle several connections, but it requires using
a specific API. The ffmpeg command-line tool does not use that API, and
therefore can only handle one connection.

It would be possible to create a muxer similar to the tee muxer capable
of streaming to several clients at once. But nobody wrote it yet.

Regards,

--
  Nicolas George
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".