#!/bin/sh
#Launch SRT-to-HLS server
TIMESTAMP=`date +%s`
#Using .bin intead of .ts since .bin gets cached by default by CloudFlare
LOCATION="seg-$TIMESTAMP-%05d.bin"
gst-launch-1.0 \
  srtsrc uri="srt://:7001?mode=listener" ! tsparse ! tsdemux name=demux \
    demux. ! queue name="vqueue" ! h264parse ! muxer. \
    demux. ! queue name="aqueue" ! aacparse ! muxer. \
      mpegtsmux name=muxer ! queue ! \
        hlssink max-files=100 location="$LOCATION" playlist-length=3 target-duration=5

#    demux. ! queue name="vqueue" ! "video/x-h264" ! h264parse ! muxer. \

