shell 如何流应该是自动重启后10秒,如果流削减

zmeyuzjn  于 2023-03-03  发布在  Shell
关注(0)|答案(1)|浏览(119)

我将重新开始使用这个脚本。但是有时由于某种原因流被切断了。
如何流应该自动重启后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文件
谢谢

gzjq41n4

gzjq41n41#

使用此命令...重新启动流的简单方法:
$find /path/directory/stream_Location/Stream1.ts -type f -mtime +10 -exec /usr/local/bin/Stream_restart {} \;

相关问题