[FFmpeg-user] Stop reading m3u8 playlist after network disconnection

Anacelia Sarlo anacelia.sarlo at gmail.com
Thu Dec 8 03:42:44 EET 2016


Hello, I'am trying to send a live stream (m3u8 playlist), delayed some
seconds to an udp stream. Sometimes it run ok, except when there is
a network disconnection (for about few seconds), where the second ffmpeg
hangs, waiting for another entry from play.m3u8 or something else.
This is the configuration:

The first ffmpeg command to download the stream and generate .ts segments
ffmpeg -nostdin -reconnect 1 -reconnect_at_eof 1 -reconnect_streamed 1
-reconnect_delay_max 1 -i http://xxxx/playlist.m3u8 -c copy -f
stream_segment -y -segment_list_flags +live -segment_list_type m3u8
-segment_list play.m3u8 -segment_time 8 -segment_wrap 20 -segment_list_size
20 -segment_format mpegts playtv%02d.ts

The second ffmpeg command (delayed 1 minute) to generate the udp stream
ffmpeg -nostdin  -rw_timeout 10000 -re -itsoffset -0.25 -i play.m3u8 -i
play.m3u8 -map 0:0 -map 1:1 -c:v copy -c:a ac3 -b:a 128k -bufsize 40M -f
mpegts -mpegts_pmt_start_pid 56 -streamid 0:58 -streamid 1:57 udp://
192.168.1.144:1234?pkt_size=1316 </dev/null 2>/dev/null

And this the ffmpeg version

ffmpeg version 3.2 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.7 (Debian 4.7.2-5)
  configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static
--extra-cflags=-I/root/ffmpeg_build/include
--extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --enable-gpl
--enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-libx264 --disable-shared --enable-openssl --enable-gnutls
--enable-nonfree
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.100 / 57. 64.100
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100


I don't know if this is the correct way to do that, or is there an option,
that ends the process after (about some seconds) trying to read the
play.m3u8
with no success.

Thanks for your suggestions.
Regards, Ana


More information about the ffmpeg-user mailing list