Spaces:
Build error
Build error
Commit
·
98775da
1
Parent(s):
6402478
let's try a hack
Browse files- scripts/archives/audio.sh +15 -0
- scripts/archives/init.sh +9 -0
- scripts/archives/stream.sh +9 -0
- scripts/archives/video.sh +15 -0
- scripts/audio.sh +27 -13
- scripts/stream.sh +4 -5
scripts/archives/audio.sh
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
echo "starting the audio collection stream.."
|
4 |
+
while true; do
|
5 |
+
num_files=$(ls $WEBTV_AUDIO_STORAGE_PATH*.mp3 2> /dev/null | wc -l)
|
6 |
+
if [ $num_files -eq 0 ]
|
7 |
+
then
|
8 |
+
sleep 1
|
9 |
+
fi
|
10 |
+
for f in $WEBTV_AUDIO_STORAGE_PATH*.mp3
|
11 |
+
do
|
12 |
+
echo "playing $f"
|
13 |
+
ffmpeg -fflags +discardcorrupt -re -i "$f" -loglevel panic -vn -acodec copy -f mp3 -y audio.pipe 2>/dev/null
|
14 |
+
done
|
15 |
+
done
|
scripts/archives/init.sh
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
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
|
scripts/archives/stream.sh
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 -fflags +discardcorrupt -re -i video.pipe -loglevel panic -stream_loop 1 -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"
|
9 |
+
done
|
scripts/archives/video.sh
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
echo "starting the video collection stream.."
|
4 |
+
while true; do
|
5 |
+
num_files=$(ls $WEBTV_VIDEO_STORAGE_PATH*.mp4 2> /dev/null | wc -l)
|
6 |
+
if [ $num_files -eq 0 ]
|
7 |
+
then
|
8 |
+
sleep 1
|
9 |
+
fi
|
10 |
+
for f in $WEBTV_VIDEO_STORAGE_PATH*.mp4
|
11 |
+
do
|
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
|
scripts/audio.sh
CHANGED
@@ -1,15 +1,29 @@
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
#
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
+
echo "Starting the audio collection stream.."
|
4 |
+
current_count=$(ls $WEBTV_AUDIO_STORAGE_PATH*.mp3 2> /dev/null | wc -l)
|
5 |
+
|
6 |
+
while true; do
|
7 |
+
new_count=$(ls $WEBTV_AUDIO_STORAGE_PATH*.mp3 2> /dev/null | wc -l)
|
8 |
+
|
9 |
+
if [ $new_count -ne $current_count ]; then
|
10 |
+
echo "Updating audio playlists..."
|
11 |
+
current_count=$new_count
|
12 |
+
files=($WEBTV_AUDIO_STORAGE_PATH*.mp3)
|
13 |
+
|
14 |
+
# Re-create the audio playlists
|
15 |
+
echo "ffconcat version 1.0" > audio_list_a.txt
|
16 |
+
echo "ffconcat version 1.0" > audio_list_b.txt
|
17 |
+
for (( i=0; i<${#files[@]}; i++ )); do
|
18 |
+
if (( i%2 == 0 )); then
|
19 |
+
echo "file '${files[$i]}'" >> audio_list_a.txt
|
20 |
+
else
|
21 |
+
echo "file '${files[$i]}'" >> audio_list_b.txt
|
22 |
+
fi
|
23 |
+
done
|
24 |
+
echo "file './audio_list_b.txt'" >> audio_list_a.txt
|
25 |
+
echo "file './audio_list_a.txt'" >> audio_list_b.txt
|
26 |
+
fi
|
27 |
+
|
28 |
+
sleep 1
|
29 |
+
done
|
scripts/stream.sh
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
-
echo "
|
4 |
while true; do
|
5 |
sleep 1
|
6 |
-
echo "
|
7 |
-
ffmpeg -
|
8 |
-
|
9 |
-
echo "final stream got interrupted, will try again in 1 sec"
|
10 |
done
|
|
|
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 panic -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"
|
|
|
9 |
done
|