[FFmpeg-user] SRT server setup, buffer overrun and connection issues

Jack Waller ffmpeg at gmail.com
Wed Oct 30 06:49:41 EET 2019


On Wed, Oct 30, 2019 at 3:05 AM James E. Baird <James.Baird at ccr.net> wrote:

> Hello,
>
> I am trying to setup an SRT server. First, we are dealing with live
> continuos streams, not files. I can get the connection setup easily enough
> and move the streams fine.
>
> I am grabbing a UDP multicast stream from one site and uploading to
> another site. Output at remote site is UDP. The transmitting server is
> setup as the listener with the remote server as the caller. I am running
> into 2 issues.
>
>
> ---------------------------------------------------------------------------------------------------
> 1. When setting up the connection, the listener side starts having
> circular buffer overruns if the caller doesn't connect within the first few
> seconds of the listener being started. I added overrun_nonfatal but found
> that even after the caller connects, the listener is still in an overrun
> state.
> Is there a way to purge the buffer once an overrun is reached? I simply
> want the stream to be available whenever the caller "dials in". So the
> listener should be available 24x7 even if the caller is offline for a few
> hours.
>
> ====Output from the listener showing this problem:
> user at hostname:~$ ffmpeg -fflags +genpts -re -i
> 'udp://x.x.x.x:xxxxx?overrun_nonfatal=1' -acodec copy -vcodec copy -strict
> -2 -y -f mpegts
> 'srt://y.y.y.y:yyyypkt_size=1316&mode=listener&passphrase=xxxxxxxxxxxx&pbkeylen=32'
> ffmpeg version N-95534-gac0f5f4 Copyright (c) 2000-2019 the FFmpeg
> developers
>   built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
>   configuration: --prefix=/home/circle/ffmpeg_build
> --pkg-config-flags=--static
> --extra-cflags=-I/home/circle/ffmpeg_build/include
> --extra-ldflags=-L/home/circle/ffmpeg_build/lib --extra-libs='-lpthread
> -lm' --bindir=/home/circle/bin --enable-libsrt --enable-gpl --enable-libass
> --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame
> --enable-libvorbis --enable-libx264 --enable-libx265 --enable-nonfree
>   libavutil      56. 35.101 / 56. 35.101
>   libavcodec     58. 59.102 / 58. 59.102
>   libavformat    58. 33.100 / 58. 33.100
>   libavdevice    58.  9.100 / 58.  9.100
>   libavfilter     7. 64.100 /  7. 64.100
>   libswscale      5.  6.100 /  5.  6.100
>   libswresample   3.  6.100 /  3.  6.100
>   libpostproc    55.  6.100 / 55.  6.100
> [mpeg2video @ 0x563bb1a8fa00] Invalid frame dimensions 0x0.
>     Last message repeated 21 times
> Input #0, mpegts, from 'udp://x.x.x.x:xxxx?overrun_nonfatal=1':
>   Duration: N/A, start: 71228.181744, bitrate: N/A
>   Program 3
>     Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
> yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions,
> 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
>     Stream #0:1[0x34](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000
> Hz, 5.1(side), fltp, 384 kb/s
>     Stream #0:2[0x35](spa): Audio: ac3 ([129][0][0][0] / 0x0081), 48000
> Hz, stereo, fltp, 96 kb/s (visual impaired) (descriptions)
> Output #0, mpegts, to
> 'srt://y.y.y.y:yyyy?pkt_size=1316&mode=listener&passphrase=xxxxxxxxxx&pbkeylen=32':
>   Metadata:
>     encoder         : Lavf58.33.100
>     Stream #0:0: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
> yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps,
> 29.97 tbr, 90k tbn, 90k tbc
>     Stream #0:1(eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz,
> 5.1(side), fltp, 384 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
>   Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> [udp @ 0x563bb1a8a0c0] Circular buffer overrun. Surviving due to
> overrun_nonfatal option   1x
>     Last message repeated 105 times
> [udp @ 0x563bb1a8a0c0] Circular buffer overrun. Surviving due to
> overrun_nonfatal option   1x
>     Last message repeated 37 times
> [mpegts @ 0x563bb1a89540] PES packet size mismatch:00:19.71
> bitrate=6787.4kbits/s speed=   1x
>     Last message repeated 1 times
> frame=  815 fps= 28 q=-1.0 size=   23899kB time=00:00:28.81
> bitrate=6793.4kbits/s speed=   1x
>
>
Never use '-re' options for live streams( such as UDP), you should only use
it in VOD streams(such as local files)
You must receive live stream at full speed in a seperate process,
otherwise, some packets could be discraded by '-re' options


>
> -------------------------------------------------------------------------------------------------------------------------
> 2. When I kill the caller side ffmpeg process, the listener side exits
> ffmpeg as well.
> Is there a way to make this survivable so the listener stays available?
>
> ====Remaining output (continuation from above) from the listener side when
> the caller connection ends:
> [udp @ 0x563bb1a8a0c0] Circular buffer overrun. Surviving due to
> overrun_nonfatal option   1x
>     Last message repeated 39 times
> [mpegts @ 0x563bb1a89540] PES packet size mismatch
>     Last message repeated 1 times
> [srt @ 0x563bb1afbf80] Operation not supported: Invalid socket
> IDte=6348.0kbits/s speed=   1x
> av_interleaved_write_frame(): Unknown error occurred
> Error writing trailer of
> srt://y.y.y.y:yyyy?pkt_size=1316&mode=listener&passphrase=xxxxxxxxxx&pbkeylen=32:
> Unknown error occurred
> frame= 5223 fps= 29 q=-1.0 Lsize=  137315kB time=00:02:57.26
> bitrate=6345.6kbits/s speed=   1x
> video:124754kB audio:8215kB subtitle:0kB other streams:0kB global
> headers:0kB muxing overhead: 3.268119%
> Conversion failed!
>
>
> ---------------------------------------------------------------------------------------------------------------------------
> The transmit/listener (server) side command being used:
> ffmpeg -fflags +genpts -re -i 'udp://x.x.x.x:xxxx?overrun_nonfatal=1'
> -acodec copy -vcodec copy -strict -2 -y -f mpegts
> 'srt://y.y.y.y:yyyy?pkt_size=1316&mode=listener&passphrase=xxxxxxxxxxxx&pbkeylen=32'
>
> The receiving/caller (client) side command being used:
> ffmpeg -re -i
> 'srt://y.y.y.y:yyyy?pkt_size=1316&mode=caller&passphrase=xxxxxxxxxx'
> -vcodec copy -acodec copy -strict -2 -y -f mpegts
> 'udp://z.z.z.z:zzzz?pkt_size=1316'
>
>


More information about the ffmpeg-user mailing list