How to write this bash script

debate.mkv can play for up to an hour

mplayer debate.mkv
rest for 60 seconds
sleep 60

how to write a script that plays mplayer debate.mkv for 4 minutes and sleep for 1 minute
until the debate.mkv is finished?

Jul.08,2021

you can use mplayer control mode, please refer to the following script

-sharp!/bin/bash
-sharp 41
set -e

movie=a.mp4
pipe=mplayer-input.fifo

mkfifo $pipe
mplayer -slave -input file=$pipe $movie >/dev/null 2>&1 &

while pgrep -P $$ mplayer >/dev/null 2>&1 ; do
    sleep 4m
    ( echo 'pause' > $pipe ) &

    sleep 1m
    ( echo 'pause' > $pipe ) &
done

rm $pipe
Menu