FFMPEG – Diffuser un flux ip multicast en adaptative smooth streaming
Un petit script bien utile pour délivrer un flux video multicast en adaptative smooth streaming :
#!/bin/sh
##Délais avant relance suite à une déconnexion entre la machine diffusant le flux adaptative et le serveur recevant les flux
SPAWN_DELAY=15
##Flux en entrée (ici du multicast) avec un cache de 100000
INPUT='udp://239.0.10.10:7400?fifo_size=100000&overrun_nonfatal=1'
##Serveur de publication des flux Smooth Streaming
PUBPOINT=http://smooth.publication.tv/flux/smooth.isml
FFMPEG_OPTIONS="-movflags isml+frag_keyframe -f ismv -threads 0"
##Paramètres audio des flux Smooth
AUDIO_OPTIONS="-c:a libfaac -ac 2 -b:a 256k"
##Parametres video des flux Smooth
VIDEO_OPTIONS="-c:v libx264 -preset:v superfast -profile:v main -level:v 3.1 -coder:v 0 -g 100 -keyint_min 100 -sc_threshold 0 - r 25"
##Filtres video
VIDEO_FILTERS="-deinterlace"
##Mappage des flux
MAP="
-map 0:v -b:v:0 800k -s:v:0 640x360
-map 0:v -b:v:1 1100k -s:v:1 1024x576
-map 0:v -b:v:2 1800k -s:v:2 1024x576
-map 0:a:0"
while true
do
EVENT_ID="$(date +%Y-%m-%d-%H_%M_%S)"
PUBPOINT_OPTIONS="/Events($EVENT_ID)/Streams(video)"
CMD="-y -re -i $INPUT $VIDEO_FILTERS $FFMPEG_OPTIONS $AUDIO_OPTIONS $VIDEO_OPTIONS $MAP ${PUBPOINT}${PUBPOINT_OPTIONS}"
echo ""
echo " **** Command line **** "
echo ffmpeg $CMD
echo ""
ffmpeg $CMD
echo ""
echo " **** Process will be respawned in $SPAWN_DELAY s **** "
echo " **** press Ctrl-C to abort **** "
echo ""
sleep $SPAWN_DELAY
done
Et voilà, vous diffusez un flux en adaptative Smooth Streaming ;)
Étiquettes : audio, mac, multicast, o, smooth, smooth streaming, stream, streaming, udp, video, x





