Tela de registro na inicialização usando o ffmpeg em segmentos de 5 minutos (12.04)

0

Então eu brinquei com isso um pouco, mas neste momento eu consegui acertar um muro na tentativa de descobrir o próximo passo.

Eu tenho este script que funciona a partir de um túnel ssh para gravar a exibição: 0.0

#!/bin/dash
# Sleep to try not to break everything YAY
sleep 30
# Export the main display
export DISPLAY=0.0
#Start an infinite loop
while true; do
        # Set variable now to todays date and the time right now in Hours-Minutes-Seconds_Month-Day-Year
        now=$(date +'%H-%M-%S_%m-%d-%Y')
        # Start recording using ffmpeg at 5fps with a time limit of 300 seconds(Five Minutes) to file $now
        ffmpeg -f x11grab -s 1024x768 -r 5 -t 300 -i :0.0 /home/swuser/Videos/$now.mp4
done

Eu tentei com um trabalho iniciante, mas ele vai travar a inicialização a menos que eu dê uma condição de sono, na qual ele não registra (suponho que ele não encontre a exibição: 0.0 mesmo que o sleep é antes da exportação) e o script continua a rodar sem fazer nada além de terminar ffmpeg repetidamente.

Para referência, estou executando ffmpeg 0.10.12-7:0.10.12-1~precise1

qualquer ajuda é muito apreciada !!

    
por JT Mechkowski 21.06.2014 / 05:24

1 resposta

1

Acabei usando o arquivo .profile e alterando meu código para estes:

Em .profile :

if [ "$RECORDISRUNNING" != "1" ]; then
    export RECORDISRUNNING=1
    /home/swuser/sleep.sh &
fi

Em sleep.sh :

#!/bin/sh
# sleep for 30 seconds then call record.sh
sleep 30
/home/swuser/scripts/record.sh &

Em record.sh

#!/bin/sh
# Check to see if there is a display, and if not, exit with error code of 1
if [ -z "$DISPLAY" ]; then
exit 1
fi
# Export the main display
export DISPLAY=0.0
# Set variable now to todays date and the time right now in Hours-Minutes-Seconds_Month-Day-Year
now=$(date +'%H-%M-%S_%m-%d-%Y')
# Start recording using ffmpeg at 5fps with a time limit of 300 seconds(Five Minutes) to file $now
ffmpeg -f x11grab -s 1024x768 -r 5 -t 300 -i :0.0 /home/swuser/Videos/$now.mp4
# Call the script again (to continually record in 300 second increments)
/home/swuser/scripts/record.sh &

E isso encerra tudo.

    
por JT Mechkowski 23.06.2014 / 22:09