On Fri, 09 Jul 2021 13:00:39 +0200, Bo Berglund <bo.bergl...@gmail.com> wrote:
>Final problem is how to run ffmpeg with an input that is a live stream >currently >playing on Youtube? >I need to detect (in a script) if the stream has frozen before I start the >download, so my plan is to run the detection and then start the download only >if >it reports that the stream is not frozen. > > To simplify things I decided to use youtube-dl inside the script to download 15-20 s of the stream to a video file: timeout --signal=2 20s youtube-dl -f 94 -o $TESTFILE $VIDEOURL Then if this succeeds it would apply the ffmpeg command shown earlier to the testfile to determine if it contains a frozen video: FFREPORT=file=ffreport.log:level=32 ffmpeg -hide_banner -t 15 -i $TESTFILE -vf "freezedetect=n=0.01:d=5" -map 0:v:0 -f null - And finally the grep to check if it had a positive: grep "lavfi.freezedetect.freeze_start: " ffreport.log if [ $? -eq "0" ] then echo "Video frozen" exit 1 else echo "Video streaming OK" exit 0 fi This way I don't have to mess with making ffmpeg read the live stream directly. -- Bo Berglund Developer in Sweden _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".