I use the code below to generate new videos (from the respective folder) by entering the student's name and CPF in each video.
However, compilation takes a long time, since the compilation time is the time of the video. I need something faster, I want the text to be inserted only from the 5th to the 10th second of the video and then stop.
As if you split the video, enter the text. No need to compile the whole video. I believe it is necessary first to make a copy of the videos and then a code that only inserts the text in time.
The script I use is:
#!/bin/bash
echo "Nome do aluno"
read nome;
echo "CPF do aluno"
read cpf;
mkdir $cpf;
echo “iniciando a compilação para o aluno $nome”
[ "$1" ] && cd "$1"
ls -1 *.mp4
[ "$?" -ne 0 ] && echo 'Sem arquivos mp4 nesse diretório' && exit 0
for ARQUIVO in $(ls -1 *.mp4)
do
ARQ_DESTINO="${ARQUIVO%%.mp4}.mp4"
echo "Convertendo $ARQUIVO para $ARQ_DESTINO"
ffmpeg -i "$ARQUIVO" -strict experimental -vf "drawtext=fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':text='Liberado para $nome - $cpf':x=200:y=10:fontsize=16:enable='between(t,5,10)'" /var/www/Arquivos/videos/$cpf/"$ARQ_DESTINO"
done
As I will sell videos online, I have set up a server to create these videos. However, each lesson package is about 6 hours long. If 4 people buy per day my server will work all day to assemble these new videos. So it's impractical, is there a faster solution?