我将使用此脚本重新启动。但有时由于某种原因,流会被切断......
如何让直播在断流10秒后自动重启。
#!/bin/bash
while true;do
grep -c "Non-monotonous DTS in output stream" file.txt >nonmonotonus.txt
grep -c "Timestamps are unset in a packet for stream" file.txt >timestamp.txt
grep -c "PES packet size mismatch" file.txt >pespacket.txt
grep -c "Error while decoding stream" file.txt >errordecoding.txt
grep -c "Circular buffer overrun" file.txt >circularbuffer.txt
grep -c "Header missing" file.txt >header.txt
grep -c "Conversion failed" file.txt >conversion.txt
file=nonmonotonus.txt
file1=timestamp.txt
file2=pespacket.txt
file3=errordecoding.txt
file4=circularbuffer.txt
file5=header.txt
file6=conversion.txt
if (($(<"$file")>=3000)) || (($(<"$file1")>=500)) || (($(<"$file2")>=100)) || (($(<"$file3")>=1000)) || (($(<"$file4")>=500)) || (($(<"$file5")>=6)) || (($(<"$file6")>=1)); then
stream1 restart > restart.txt
sleep 1
fi
done
__________________________________________________________________________
FFmpeg -re -threads 3 -c:s webvtt -i "$INPUT_URL?source=null&overrun_nonfatal=1&fifo_size=1000000" \
-c:v copy \
-map 0:0 -map 0:1 \
-c:a aac -b:a 128k -ar 48000 \
-threads 4 -f hls -hls_time 2 -hls_wrap 15 \
"manifest.m3u8" \
</dev/null > /dev/null 2>&1 2>file.txt & echo $! > $STREAM_PID_PATH
剪切.ts文件后如何自动重启流
谢谢...
最佳答案
使用此命令...重新启动流的简单方法:
$find/path/directory/stream_Location/Stream1.ts -type f -mtime +10 -exec/usr/local/bin/Stream_restart {}\;
关于bash - 断流10秒后如何自动重启,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74664411/