Skip to content

Instantly share code, notes, and snippets.

@arthurprogramming
Last active August 29, 2015 14:13
Show Gist options
  • Save arthurprogramming/f75dc91e2794cf1341e6 to your computer and use it in GitHub Desktop.
Save arthurprogramming/f75dc91e2794cf1341e6 to your computer and use it in GitHub Desktop.
Making 10 hours videos
#!/bin/bash
COMMAND=$1
FILE_NAME=$2
LIST_FILE="lista.txt"
case $COMMAND in
"make10")
TIME=$3
OUTPUTFILE=$4
if [[ $TIME -lt 1 ]] ; then
echo "Informe um tempo maior que 0!"
exit 1
fi
if [[ -z $OUTPUTFILE ]] ; then
echo "Informe um nome para arquivo de saída!"
exit 1
fi
if [[ -e $LIST_FILE ]]; then
rm $LIST_FILE
fi
REPEAT_TIMES=`expr 36000 / $TIME`
echo "Repetiremos o vídeo $REPEAT_TIMES vezes!"
for i in `seq 1 $REPEAT_TIMES`
do
echo "file $FILE_NAME" >> $LIST_FILE
done
echo "Executing..."
echo ""
ffmpeg -f concat -i $LIST_FILE -c copy $OUTPUTFILE
echo "Acabou!"
exit 0
;;
"makeLittle")
OUTPUT=$3
if [[ -z $OUTPUT ]] ; then
echo "Informe um nome para arquivo de saída!"
exit 1
fi
ffmpeg -i $FILE_NAME -vcodec libx264 -vprofile baseline -vf scale=-1:360 -threads 0 -ab 96k -crf 20 -strict -2 $OUTPUT
echo "Feito!"
exit 0
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment