Merge branch 'main' of https://git.alice.ufsj.edu.br/emerson/AliceClass
Deploy / Deploy (push) Failing after 16s
Details
Deploy / Deploy (push) Failing after 16s
Details
This commit is contained in:
commit
2802264eb3
|
@ -7,53 +7,79 @@ TMP=$(mktemp -d)
|
|||
ASSETS="$TMP/assets"
|
||||
PARAM="scale=1920:1080: force_original_aspect_ratio=decrease: eval=frame,pad=1920:1080: -1:-1:color=black"
|
||||
|
||||
VIDEOS_PATH=/var/www/html/aliceclass_videos
|
||||
|
||||
|
||||
create_thumb () {
|
||||
THUMB_PATH=$1
|
||||
SRC_FILE=$2
|
||||
|
||||
if test ! -f "${THUMB_PATH}" ; then
|
||||
ffmpeg -y -i "${SRC_FILE}" -vframes 1 -an -s 400x222 -ss 30 "${THUMB_PATH}"
|
||||
fi
|
||||
}
|
||||
|
||||
create_intro_clip () {
|
||||
AUTHOR=$1
|
||||
VIDEO_TITLE=$2
|
||||
|
||||
# sed "s/nomenome/$AUTHOR/g" ${SCRIPT}/intro.svg | sed "s/curso/${VIDEO_TITLE}/g" > ${TMP}/tmp-intro.svg
|
||||
sed "s/nomenome/$AUTHOR/g; s/curso/${VIDEO_TITLE}/g" ${SCRIPT}/intro.svg > ${TMP}/tmp-intro.svg
|
||||
ffmpeg -y -loop 1 -i ${TMP}/tmp-intro.svg -i ${SCRIPT}/intro.wav -shortest ${TMP}/tmp-intro.mkv
|
||||
|
||||
}
|
||||
|
||||
process_video () {
|
||||
NAME=$1
|
||||
|
||||
# VIDEO_TITLE=$1
|
||||
# USERNAME=$2
|
||||
# SRC_FILE=$3
|
||||
# AULA=$4
|
||||
# DEST_FILE=$5
|
||||
|
||||
VIDEO_TITLE=$1
|
||||
AUTHOR=$2
|
||||
INPUT=$3
|
||||
SRC_FILE=$3
|
||||
AULA=$4
|
||||
OUTPUT=$5
|
||||
DEST_FILE=$5
|
||||
|
||||
# no output path
|
||||
if [ -z "$OUTPUT" ]; then
|
||||
OUTPUT="$ASSETS/videos/${NAME}.mp4"
|
||||
if [ -z "$DEST_FILE" ]; then
|
||||
DEST_FILE="$ASSETS/videos/${VIDEO_TITLE}.mp4"
|
||||
fi
|
||||
|
||||
THUMB_PATH=$(dirname $(dirname $OUTPUT))/thumbs/$NAME
|
||||
echo $THUMB_PATH
|
||||
THUMB_PATH="${VIDEOS_PATH}/$AUTHOR/thumbs/${VIDEO_TITLE}.jpg"
|
||||
# THUMB_PATH=$(dirname $(dirname $DEST_FILE))/thumbs/${VIDEO_TITLE}.jpg
|
||||
|
||||
echo "########################################"
|
||||
echo "# Aula: ${AULA}"
|
||||
echo "# Thumb Path: $THUMB_PATH"
|
||||
echo "# Author: ${AUTHOR}"
|
||||
echo "# Input: ${INPUT}"
|
||||
echo "# Input: ${SRC_FILE}"
|
||||
echo "# Src: ${SRC}"
|
||||
echo "# Dest: ${OUTPUT}"
|
||||
echo "# Name: ${NAME}"
|
||||
echo "# Dest: ${DEST_FILE}"
|
||||
echo "# Name: ${VIDEO_TITLE}"
|
||||
echo "# Script Path: ${SCRIPT}"
|
||||
echo "########################################"
|
||||
# exit
|
||||
|
||||
|
||||
# ####################################
|
||||
# Creating the thumbnail if does not exist
|
||||
# ####################################
|
||||
if test ! -f "${THUMB_PATH}.jpg" ; then
|
||||
ffmpeg -y -i "${INPUT}" -vframes 1 -an -s 400x222 -ss 30 "${THUMB_PATH}.jpg"
|
||||
fi
|
||||
create_thumb "${THUMB_PATH}" "${SRC_FILE}"
|
||||
|
||||
# ####################################
|
||||
# if output exist, continue
|
||||
# ####################################
|
||||
if test -f "$ASSETS/videos/${NAME}.mp4" ; then
|
||||
if test -f "$ASSETS/videos/${VIDEO_TITLE}.mp4" ; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# ####################################
|
||||
# Creating the intro clip
|
||||
# ####################################
|
||||
# sed "s/nomenome/$AUTHOR/g" ${SCRIPT}/intro.svg | sed "s/curso/${NAME}/g" > ${TMP}/tmp-intro.svg
|
||||
sed "s/nomenome/$AUTHOR/g; s/curso/${NAME}/g" ${SCRIPT}/intro.svg > ${TMP}/tmp-intro.svg
|
||||
ffmpeg -y -loop 1 -i ${TMP}/tmp-intro.svg -i ${SCRIPT}/intro.wav -shortest ${TMP}/tmp-intro.mkv
|
||||
create_intro_clip "${AUTHOR}" "${VIDEO_TITLE}"
|
||||
|
||||
# ###################################################
|
||||
# Audio adjustment
|
||||
|
@ -63,12 +89,12 @@ process_video () {
|
|||
# -af dynaudnorm=p=1
|
||||
# -af speechnorm=e=12.5:r=0.0001:l=1
|
||||
# -af acompressor=threshold=0.089:ratio=9:attack=200:release=1000:makeup=2
|
||||
ffmpeg -y -i "${INPUT}" -af dynaudnorm=p=1 ${TMP}/tmp-normalized.mkv
|
||||
ffmpeg -y -i "${SRC_FILE}" -af dynaudnorm=p=1 ${TMP}/tmp-normalized.mkv
|
||||
|
||||
# ####################################################
|
||||
# Wartermarking the video file
|
||||
# ####################################################
|
||||
sed "s/nomenome/$AUTHOR/g" ${SCRIPT}/watermark.svg | sed "s/curso/${NAME}/g" > ${TMP}/tmp-watermark.svg
|
||||
sed "s/nomenome/$AUTHOR/g" ${SCRIPT}/watermark.svg | sed "s/curso/${VIDEO_TITLE}/g" > ${TMP}/tmp-watermark.svg
|
||||
# add watermark to video
|
||||
ffmpeg -y -i ${TMP}/tmp-normalized.mkv -i ${TMP}/tmp-watermark.svg -i ${SCRIPT}/logo.png \
|
||||
-filter_complex "[0][1]overlay=5:H-h-5:format=auto[bg];[bg][2]overlay=W-w-5:5:format=auto" -c:a copy ${TMP}/tmp-video.mkv
|
||||
|
@ -89,7 +115,7 @@ process_video () {
|
|||
-vcodec libx264 \
|
||||
-pix_fmt yuv420p \
|
||||
-vsync 2 \
|
||||
"$OUTPUT"
|
||||
"$DEST_FILE"
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,12 +124,12 @@ process_video () {
|
|||
# ####################################
|
||||
# Creating the credits clip
|
||||
# ####################################
|
||||
#if test ${TMP}/tmp-credits.mkv -ot ${SCRIPT}/credits.svg ; then
|
||||
if test ${TMP}/tmp-credits.mkv -ot ${SCRIPT}/credits.svg ; then
|
||||
echo "########################################"
|
||||
echo "# Gerando o tmp-credits.mkv"
|
||||
echo "########################################"
|
||||
ffmpeg -y -loop 1 -i ${SCRIPT}/credits.svg -i ${SCRIPT}/credits.wav -shortest ${TMP}/tmp-credits.mkv
|
||||
#fi
|
||||
fi
|
||||
|
||||
# ####################################
|
||||
# Creating dest dir
|
||||
|
@ -113,12 +139,12 @@ mkdir -p $ASSETS/videos
|
|||
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
NAME=$1
|
||||
VIDEO_TITLE=$1
|
||||
AUTHOR=$2
|
||||
INPUT=$3
|
||||
SRC_FILE=$3
|
||||
AULA=$4
|
||||
OUTPUT=$5
|
||||
process_video "$NAME" "$AUTHOR" "$INPUT" "$AULA" "$OUTPUT"
|
||||
DEST_FILE=$5
|
||||
process_video "$VIDEO_TITLE" "$AUTHOR" "$SRC_FILE" "$AULA" "$DEST_FILE"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
@ -126,11 +152,11 @@ fi
|
|||
# # ####################################
|
||||
# # Getting parameters from aulas
|
||||
# # ####################################
|
||||
# NAME="$(basename "${aula}" .md)"
|
||||
# VIDEO_TITLE="$(basename "${aula}" .md)"
|
||||
# AUTHOR=$(grep "^author: " "${aula}" | sed -e 's/author: //g')
|
||||
# INPUT="${SRC}/${NAME}.mkv"
|
||||
# SRC_FILE="${SRC}/${VIDEO_TITLE}.mkv"
|
||||
#
|
||||
# process_video "$NAME" "$AUTHOR" "$INPUT"
|
||||
# process_video "$VIDEO_TITLE" "$AUTHOR" "$SRC_FILE"
|
||||
# done
|
||||
|
||||
# rm -f ${TMP}
|
||||
|
|
Loading…
Reference in New Issue