Message ID | CANWt731LZUFnP4jPB4apT0YvfzDRwE+7nXf6tnSOaVmjFj8BZg@mail.gmail.com |
---|---|
State | Superseded |
Headers | show |
On Wed, Aug 22, 2018 at 4:30 AM Tudor Suciu <tudor.suciu@gmail.com> wrote: > > Hello, > > I get errors when I try to send a live srt stream that the first packet is > too big: > 21:30:39.896626/ffmpeg*E: SRT.c: LiveSmoother: payload size: 1504 exceeds > maximum allowed 1316 > > Here are example commands for server and client: > ffmpeg -re -i ~/Downloads/ToS-4k-1920.mov -vcodec libx264 -g 50 -refs 1 -s > 640x360 -b:v 1000k -acodec aac -b:a 64k -flush_packets 0 -f mpegts "srt:// > 127.0.0.1:5555?mode=listener" > ffplay srt://127.0.0.1:5555 > > A patch that fully solves the issue is: > diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c > index 0f9529d263..156a4776e2 100644 > --- a/libavformat/libsrt.c > +++ b/libavformat/libsrt.c > @@ -412,6 +412,8 @@ static int libsrt_open(URLContext *h, const char *uri, > int flags) > return AVERROR_UNKNOWN; > } > > + h->max_packet_size = 1316; > + > /* SRT options (srt/srt.h) */ > p = strchr(uri, '?'); > if (p) { > > How would you like this option to be made work in a way that can be > accepted in ffmpeg? > Is there a way to change the max packet size without this patch? > In your case, I don't think hard coding max packet size == 1316 is not a good idea in loopback device, and after deep in the srt library(https://github.com/Haivision/srt) source code, I think srt library need to fix the hardcode about packet size limition.
On Thu, 23 Aug 2018, mypopy@gmail.com wrote: > On Wed, Aug 22, 2018 at 4:30 AM Tudor Suciu <tudor.suciu@gmail.com> wrote: >> >> Hello, >> >> I get errors when I try to send a live srt stream that the first packet is >> too big: >> 21:30:39.896626/ffmpeg*E: SRT.c: LiveSmoother: payload size: 1504 exceeds >> maximum allowed 1316 >> >> Here are example commands for server and client: >> ffmpeg -re -i ~/Downloads/ToS-4k-1920.mov -vcodec libx264 -g 50 -refs 1 -s >> 640x360 -b:v 1000k -acodec aac -b:a 64k -flush_packets 0 -f mpegts "srt:// >> 127.0.0.1:5555?mode=listener" >> ffplay srt://127.0.0.1:5555 >> >> A patch that fully solves the issue is: >> diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c >> index 0f9529d263..156a4776e2 100644 >> --- a/libavformat/libsrt.c >> +++ b/libavformat/libsrt.c >> @@ -412,6 +412,8 @@ static int libsrt_open(URLContext *h, const char *uri, >> int flags) >> return AVERROR_UNKNOWN; >> } >> >> + h->max_packet_size = 1316; >> + >> /* SRT options (srt/srt.h) */ >> p = strchr(uri, '?'); >> if (p) { >> >> How would you like this option to be made work in a way that can be >> accepted in ffmpeg? >> Is there a way to change the max packet size without this patch? >> > In your case, I don't think hard coding max packet size == 1316 is not > a good idea in loopback device, and after deep in the srt > library(https://github.com/Haivision/srt) source code, I think srt > library need to fix the hardcode about packet size limition. I can't think of a scenario where limiting the packet size actually causes problems, but if you insist on not limiting it in general, then the max packet size should be settable using an option, same way it is for UDP. (pkt_size option). I'd suggest using 1316 as default, because that is the more common (and currently the only working) use case... Thanks, Marton
On Fri, Aug 24, 2018 at 2:55 AM Marton Balint <cus@passwd.hu> wrote: > > > > On Thu, 23 Aug 2018, mypopy@gmail.com wrote: > > > On Wed, Aug 22, 2018 at 4:30 AM Tudor Suciu <tudor.suciu@gmail.com> wrote: > >> > >> Hello, > >> > >> I get errors when I try to send a live srt stream that the first packet is > >> too big: > >> 21:30:39.896626/ffmpeg*E: SRT.c: LiveSmoother: payload size: 1504 exceeds > >> maximum allowed 1316 > >> > >> Here are example commands for server and client: > >> ffmpeg -re -i ~/Downloads/ToS-4k-1920.mov -vcodec libx264 -g 50 -refs 1 -s > >> 640x360 -b:v 1000k -acodec aac -b:a 64k -flush_packets 0 -f mpegts "srt:// > >> 127.0.0.1:5555?mode=listener" > >> ffplay srt://127.0.0.1:5555 > >> > >> A patch that fully solves the issue is: > >> diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c > >> index 0f9529d263..156a4776e2 100644 > >> --- a/libavformat/libsrt.c > >> +++ b/libavformat/libsrt.c > >> @@ -412,6 +412,8 @@ static int libsrt_open(URLContext *h, const char *uri, > >> int flags) > >> return AVERROR_UNKNOWN; > >> } > >> > >> + h->max_packet_size = 1316; > >> + > >> /* SRT options (srt/srt.h) */ > >> p = strchr(uri, '?'); > >> if (p) { > >> > >> How would you like this option to be made work in a way that can be > >> accepted in ffmpeg? > >> Is there a way to change the max packet size without this patch? > >> > > In your case, I don't think hard coding max packet size == 1316 is not > > a good idea in loopback device, and after deep in the srt > > library(https://github.com/Haivision/srt) source code, I think srt > > library need to fix the hardcode about packet size limition. > > I can't think of a scenario where limiting the packet size actually causes > problems, but if you insist on not limiting it in general, then the max > packet size should be settable using an option, same way it is for UDP. > (pkt_size option). I'd suggest using 1316 as default, because that > is the more common (and currently the only working) use case... > > Thanks, > Marton I agree with you, giving an option like pkt_size and using 1316 as the default in this case is a better way to fix this issue.
diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index 0f9529d263..156a4776e2 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -412,6 +412,8 @@ static int libsrt_open(URLContext *h, const char *uri, int flags) return AVERROR_UNKNOWN; } + h->max_packet_size = 1316; + /* SRT options (srt/srt.h) */ p = strchr(uri, '?');