Compare commits

..

8 Commits

+97 -4
View File
@@ -249,20 +249,42 @@ function blog { echo -e "\n\n$1\n\n"; }
function pull {
if [[ -d .git ]]; then
echo "Recognized git project, pulling latest changes."
git pull --recurse-submodules
else
echo "Not a git repo, attempting to sync with SFTP server."
pull-clone
fi
}
function push {
if [[ -d .git ]]; then
echo "Recognized git project, promoting branch to stage and prod."
git push && eval load-stage && eval load-prod
else
echo "Not a git repo, attempting to sync with SFTP server."
send-master
fi
}
function set-variable {
var="$1"
val="$2"
echo -n "export $var=\"$val\" - "
export $var="$val"
status="$?"
if [[ "$val" == "${!var}" ]]; then
echo "Success!"
return 0
fi
echo "Failed with status '$status', $var is '${!var}'."
return $status
}
alias set-var="set-variable "
# Enhance Bin Scripts #
# MASTER and CLONE folders.
@@ -420,26 +442,51 @@ function process-video {
if [[ -z $size ]]; then
size="720"
fi
size="-filter:v scale=-1:$size"
# Lanczos is good for upscaling, but this is usually used for downscaling.
if [[ ! -z "$PV_VERTICAL_ASPECT_RATIO" ]]; then
size="-filter:v scale=$size:-1" #:flags=lanczos"
else
size="-filter:v scale=-1:$size" #:flags=lanczos"
fi
if [[ -z $passes ]]; then
passes=1
fi
pass=""
if [[ $passes != 1 ]]; then
if [[ $passes != 1 || ! -z "$PV_2PASS" ]]; then
passes=2
pass="-pass 2"
fi
v2=""
if [[ ! -z "$PV_V2" ]]; then
v2="-crf 18 -preset veryslow -c:a aac -ar 48000"
#-profile:v high - Letting ffmpeg use the default profile.
fi
time=""
if [[ ! -z "$PV_TIME" ]]; then
time="`which time`"
fi
quiet="-hide_banner -loglevel level+warning"
if [[ ! -z "$PV_PROGRESS" ]]; then
quiet="-hide_banner -loglevel level+info"
fi
if [[ ! -z "$PV_VERBOSE" ]]; then
quiet="-loglevel level+verbose"
fi
## Main ##
# More information on two-pass processing with ffmpeg
# https://cinelerra-gg.org/download/CinelerraGG_Manual/Two_pass_Encoding_with_FFmp.html
if [[ $passes == 2 ]]; then
set -x
ffmpeg -nostdin -hide_banner -loglevel quiet \
$time ffmpeg -nostdin $quiet \
-i "$file" $size $video $audio \
-filter:a "dynaudnorm=f=33:g=65:p=0.66:m=33.3" \
-vcodec libx264 -movflags +faststart \
$v2 \
-pass 1 -f mp4 /dev/null -y
status=$?
set +x
@@ -451,10 +498,11 @@ function process-video {
fi
set -x &&
ffmpeg -nostdin -hide_banner -loglevel quiet \
$time ffmpeg -nostdin $quiet \
-i "$file" $size $video $audio \
-filter:a "dynaudnorm=f=33:g=65:p=0.66:m=33.3" \
-vcodec libx264 -movflags +faststart \
$v2 \
$pass "$newfile"
status="$?"
set +x
@@ -477,6 +525,13 @@ function process-video {
echo "ERROR: New file not created or has a 0 size." >&2
fi
unset PV_VERTICAL_ASPECT_RATIO
unset PV_V2
unset PV_TIME
unset PV_PROGRESS
unset PV_VERBOSE
unset PV_2PASS
echo -e "\n`date` - Finished with status '$status'."
return $status
}
@@ -484,6 +539,44 @@ alias pv="process-video"
alias fn='basename `pwd`' # Folder Name
alias qpv='pv ./raw/YouCut*.mp4 `fn`.mp4' # Quick Process Video
alias set-pv-vertical='set-var PV_VERTICAL_ASPECT_RATIO "y" '
alias set-pv-time='set-var PV_TIME "y" '
alias set-pv-progress='set-var PV_PROGRESS "y" '
alias set-pv-verbose='set-var PV_VERBOSE "y" '
alias set-pv-2pass='set-var PV_2PASS "y" '
alias set-pv-v2='set-var PV_V2 "y" '
alias set-pv-vert='set-pv-vertical '
alias set-pv2='set-pv-v2; set-pv-2pass; set-pv-progress '
alias pvs='set-pv-vert; pv '
alias pv2='set-pv2; pv '
alias pv2s='set-pv2; set-pv-vert; pv '
alias pvs2='pv2s '
alias qpv2='set-pv2; qpv '
function set-pv-all {
#set-var PV_VERTICAL_ASPECT_RATIO "y"
set-var PV_V2 "y"
set-var PV_TIME "y"
set-var PV_PROGRESS "y"
set-var PV_VERBOSE "y"
set-var PV_2PASS "y"
}
alias set-pv-everything='set-pv-all '
function unset-pv-all {
unset PV_VERTICAL_ASPECT_RATIO
unset PV_V2
unset PV_TIME
unset PV_PROGRESS
unset PV_VERBOSE
unset PV_2PASS
}
alias unset-pv-everything='unset-pv-all '
# Allow converting video to audio and other smaller
# tasks than what process-video is intended to do.
function basic-process-usage {