Spaces:
Build error
Build error
Commit
·
6ac357b
1
Parent(s):
935c12f
skip nohup for now
Browse files- scripts/init.sh +6 -0
- scripts/stream.sh +10 -0
- scripts/video.sh +25 -10
- start.sh +3 -3
scripts/init.sh
CHANGED
@@ -4,6 +4,12 @@ echo "creating the storage folders.."
|
|
4 |
mkdir -p $WEBTV_VIDEO_STORAGE_PATH
|
5 |
mkdir -p $WEBTV_AUDIO_STORAGE_PATH
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
echo "create the named pipes.."
|
8 |
mkfifo video.pipe
|
9 |
mkfifo audio.pipe
|
|
|
4 |
mkdir -p $WEBTV_VIDEO_STORAGE_PATH
|
5 |
mkdir -p $WEBTV_AUDIO_STORAGE_PATH
|
6 |
|
7 |
+
echo "creating the playlists.."
|
8 |
+
echo "ffconcat version 1.0" > list_a.txt
|
9 |
+
echo "ffconcat version 1.0" > list_b.txt
|
10 |
+
echo "file './list_b.txt'" >> list_a.txt
|
11 |
+
echo "file './list_a.txt'" >> list_b.txt
|
12 |
+
|
13 |
echo "create the named pipes.."
|
14 |
mkfifo video.pipe
|
15 |
mkfifo audio.pipe
|
scripts/stream.sh
CHANGED
@@ -1,8 +1,18 @@
|
|
1 |
#!/bin/bash
|
2 |
|
|
|
|
|
3 |
echo "Starting final stream loop.."
|
4 |
while true; do
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
sleep 1
|
|
|
6 |
echo "Trying to create the final stream.."
|
7 |
ffmpeg -y -nostdin -re -f concat -safe 0 -i "list_a.txt" -i "audio_list_a.txt" -loglevel error -c:v libx264 -preset veryfast -tune zerolatency -c:a aac -ar 44100 -f flv rtmp://localhost/live/webtv
|
8 |
echo "Final stream got interrupted, will try again in 1 sec"
|
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
+
COUNT=0
|
4 |
+
|
5 |
echo "Starting final stream loop.."
|
6 |
while true; do
|
7 |
+
if ((COUNT % 30 == 0)); then
|
8 |
+
echo "--- video list_a.txt ---"
|
9 |
+
cat list_a.txt
|
10 |
+
|
11 |
+
echo "--- audio_list_a.txt ---"
|
12 |
+
cat audio_list_a.txt
|
13 |
+
fi
|
14 |
sleep 1
|
15 |
+
((COUNT++))
|
16 |
echo "Trying to create the final stream.."
|
17 |
ffmpeg -y -nostdin -re -f concat -safe 0 -i "list_a.txt" -i "audio_list_a.txt" -loglevel error -c:v libx264 -preset veryfast -tune zerolatency -c:a aac -ar 44100 -f flv rtmp://localhost/live/webtv
|
18 |
echo "Final stream got interrupted, will try again in 1 sec"
|
scripts/video.sh
CHANGED
@@ -1,15 +1,30 @@
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
-
echo "
|
|
|
|
|
4 |
while true; do
|
5 |
-
|
6 |
-
|
7 |
-
then
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
fi
|
10 |
-
|
11 |
-
|
12 |
-
echo "playing $f"
|
13 |
-
ffmpeg -fflags +discardcorrupt -re -i "$f" -loglevel panic -vcodec copy -f mpegts -y video.pipe 2>/dev/null
|
14 |
-
done
|
15 |
done
|
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
+
echo "Starting the video collection stream.."
|
4 |
+
current_count=$(ls $WEBTV_VIDEO_STORAGE_PATH*.mp4 2> /dev/null | wc -l)
|
5 |
+
|
6 |
while true; do
|
7 |
+
new_count=$(ls $WEBTV_VIDEO_STORAGE_PATH*.mp4 2> /dev/null | wc -l)
|
8 |
+
|
9 |
+
if [ $new_count -ne $current_count ]; then
|
10 |
+
echo "Updating playlists..."
|
11 |
+
current_count=$new_count
|
12 |
+
files=($WEBTV_VIDEO_STORAGE_PATH*.mp4)
|
13 |
+
|
14 |
+
# Re-create playlists
|
15 |
+
echo "ffconcat version 1.0" > list_a.txt
|
16 |
+
echo "ffconcat version 1.0" > list_b.txt
|
17 |
+
for (( i=0; i<${#files[@]}; i++ )); do
|
18 |
+
echo "file '${files[$i]}'"
|
19 |
+
if (( i%2 == 0 )); then
|
20 |
+
echo "file '${files[$i]}'" >> list_a.txt
|
21 |
+
else
|
22 |
+
echo "file '${files[$i]}'" >> list_b.txt
|
23 |
+
fi
|
24 |
+
done
|
25 |
+
echo "file './list_b.txt'" >> list_a.txt
|
26 |
+
echo "file './list_a.txt'" >> list_b.txt
|
27 |
fi
|
28 |
+
|
29 |
+
sleep 1
|
|
|
|
|
|
|
30 |
done
|
start.sh
CHANGED
@@ -11,15 +11,15 @@ node ./media-server.js &
|
|
11 |
sleep 1
|
12 |
|
13 |
# background process that creates an audio stream from audio files
|
14 |
-
|
15 |
|
16 |
# background process that creates a video stream from video files
|
17 |
-
|
18 |
|
19 |
sleep 1
|
20 |
|
21 |
# background process that sends data to the media server
|
22 |
-
|
23 |
|
24 |
sleep 1
|
25 |
|
|
|
11 |
sleep 1
|
12 |
|
13 |
# background process that creates an audio stream from audio files
|
14 |
+
bash scripts/audio.sh &
|
15 |
|
16 |
# background process that creates a video stream from video files
|
17 |
+
bash scripts/video.sh &
|
18 |
|
19 |
sleep 1
|
20 |
|
21 |
# background process that sends data to the media server
|
22 |
+
bash scripts/stream.sh &
|
23 |
|
24 |
sleep 1
|
25 |
|