Answer the question
In order to leave comments, you need to log in
How to force VLC not to create a file if there is no broadcast?
Hello! Please help with a small problem, I record using the vlc broadcast with the following script:
#!/bin/bash
while true
do
file_time=`date +%H.%M.%S`
cvlc http://localhost:8080 --network-caching=10 --sout file/ts:./$file_time.ts --run-time 300 --play-and-exit
done
exit 0
Answer the question
In order to leave comments, you need to log in
In general, I did this, files of zero size are simply deleted, and if the script detects such files, then it sets a random time delay, after which it restarts the cycle again in an attempt to record the broadcast
#!/bin/bash
while true
do
file_time=`date +%H.%M.%S`
cvlc http://localhost:8080 --network-caching=10 --sout file/ts:./$file_time.ts --run-time 300 --play-and-exit
null=`stat -c %s *.ts | grep -w 0 | head -1`
rand=`shuf -i 5-15 -n 1`
if [ $null -eq 0 ]
then
sleep $rand
fi
find . -size 0 -delete
done
exit 0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question