1
0

Misc. fixes

Signed-off-by: James Ketrenos <jketreno@media.ketrenos.com>
This commit is contained in:
James Ketrenos 2022-10-11 11:32:57 -07:00
parent a70b1fc11b
commit 7745b3437a

View File

@ -17,8 +17,9 @@ usage: normalize-video [OPTIONS] [FILES]
Options:
-h This help
-s Force software only encode and decode
-o OLDER Only process files older than OLDER. See 'find -newer'
-f Force transcode even if already meets normalized
-f Force transcode even if already meets normalized
settings.
EOF
@ -26,8 +27,12 @@ EOF
force=0
older_than=
while getopts fho: opt; do
sw_only=
while getopts fho:s opt; do
case "${opt}" in
s)
sw_only=1
;;
o)
older_than="-and -not -newer ${OPTARG}"
;;
@ -49,15 +54,16 @@ shift $(( OPTIND-1 ))
VIDEO=$(getent group video | sed -E 's,^video:[^:]*:([^:]*):.*$,\1,')
RENDER=$(getent group render | sed -E 's,^render:[^:]*:([^:]*):.*$,\1,')
sw_only=0
if [[ "${VIDEO}" != "" ]]; then
sw_only=0
ADD_GROUPS="--group-add ${VIDEO}"
if [[ "${RENDER}" != "" ]]; then
ADD_GROUPS+=" --group-add ${RENDER}"
if [[ "${sw_only}" == "" ]]; then
if [[ "${VIDEO}" != "" ]]; then
sw_only=0
ADD_GROUPS="--group-add ${VIDEO}"
if [[ "${RENDER}" != "" ]]; then
ADD_GROUPS+=" --group-add ${RENDER}"
fi
else
sw_only=1
fi
else
sw_only=1
fi
quiet="
@ -129,9 +135,10 @@ ffmpeg_hw_or_sw() {
-c:a copy
-c:s copy
-c:v libx264
-vf scale=${width}:${height},format=yuv420p \
-preset veryslow \
-crf 20 \
-max_muxing_queue_size 1024
-vf scale=${width}:${height},format=yuv420p
-preset veryslow
-crf 20
"
# -metadata "title='${TITLE}'" \
@ -249,21 +256,21 @@ function check_and_convert {
width=$(ffprobe \
-v error \
-select_streams v \
-select_streams v:0 \
-show_entries "stream=width" \
"${IN}" | sed -ne 's,width=,,p'
)
height=$(ffprobe \
-v error \
-select_streams v \
-select_streams v:0 \
-show_entries "stream=height" \
"${IN}" | sed -ne 's,height=,,p'
)
pix_fmt=$(ffprobe \
-v error \
-select_streams v \
-select_streams v:0 \
-show_entries "stream=pix_fmt" \
"${IN}" | sed -ne 's,pix_fmt=,,p'
)
@ -458,9 +465,10 @@ if [ -z "$1" ]; then
find . -name '* *' -type f | while read file; do mv "${file}" "${file// /_}" || fail "Unable to rename file ${file}"; done
matches="
\(
-name '*mkv'
-or -name '*mp4'
-or -name '*avi'
-iname '*.mkv'
-or -iname '*.mp4'
-or -iname '*.avi'
-or -iname '*.mov'
\)
-and -not -path './backup/*'
${older_than}
@ -479,8 +487,9 @@ fi && {
cat << EOF
To transfer the updated files:
cd /multimedia/Downloads
rsync -avprlP --remove-source-files /multimedia/Downloads/ azurite:/multimedia/
find /multimedia/Downloads/ -type d -empty -delete
find . -type d -empty -delete
EOF
}