-
-
Save lyarinet/4f7690918a1bafb1f13c0e5446efb0d1 to your computer and use it in GitHub Desktop.
IPTV to HTTP live streaming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true; do | |
currTime=`date +%Y%m%d%H%M` | |
if [ "$currTime" -ge 201507081658 -a "$currTime" -le 201507082300 ]; then | |
echo "$currTime: Stream should be on. Start ffmpeg if the process does not exist" | |
if [ "$(pidof ffmpeg)" ]; then | |
echo "$currTime: ffmpeg already running." | |
sleep 10 | |
else | |
echo "$currTime: ffmpeg not running. Start it" | |
ffmpeg -i 'udp://239.193.4.70:5000' -vcodec libx264 -profile:v high -level:v 4.1 -crf 23 -preset veryfast -vf "yadif" -s 640x320 -maxrate 800k -bufsize 1600k -hls_wrap 16 -acodec libmp3lame -ac 2 -b:a 128k -strict experimental "ftp://iptv1:[email protected]/tv.elvery.net/hls.m3u8" & | |
fi | |
else | |
echo "$currTime: Stream should be off. Kill ffmpeg if the process exists" | |
killall ffmpeg | |
sleep 10 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment