Skip to content

Commit

Permalink
Merge pull request #298 from mediamicroservices/mm-updates
Browse files Browse the repository at this point in the history
Mm updates
  • Loading branch information
dericed authored Feb 21, 2023
2 parents 526ccc3 + c6b544e commit fdb0983
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
1 change: 0 additions & 1 deletion makederiv
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ while [[ "${@}" != "" ]] ; do
MIDDLEOPTIONSIMX+=(-aspect 4:3)
MIDDLEOPTIONSIMX+=(-qmax 12)
MIDDLEOPTIONSIMX+=(-g 1)
MIDDLEOPTIONSIMX+=(-top 1)
MIDDLEOPTIONSIMX+=(-b:v 30M)
MIDDLEOPTIONSIMX+=(-maxrate:v 30M)
MIDDLEOPTIONSIMX+=(-minrate:v 30M)
Expand Down
38 changes: 24 additions & 14 deletions makegifsummary
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ _usage(){
echo "Dependencies: ${DEPENDENCIES[@]}"
echo "Usage: $(basename ${0}) [ -d /path/to/deliver/to/ ] fileorpackage1 [ fileorpackage2 ...]"
echo " -d directory ( directory to deliver the resulting file to )"
echo " -o directory ( directory to write the resulting file to )"
echo " -o file or directory ( directory or filepath to write the resulting file to )"
echo " -n (dry-run mode, show the commands that would be run but don't do anything)"
echo " -h display this help"
echo
Expand All @@ -33,7 +33,7 @@ while getopts ":d:e:E:o:nh" OPT ; do
d) DELIVERDIR="${OPTARG}" && _check_deliverdir ;;
e) EMAILADDRESS_DELIVERY="${OPTARG}" && check_emailaddress "${EMAILADDRESS_DELIVERY}" ;;
E) EMAILADDRESS_OUTCOME="${OPTARG}" && check_emailaddress "${EMAILADDRESS_OUTCOME}" ;;
o) OUTPUTDIR_FORCED="${OPTARG}" && _check_outputdir_forced ;;
o) OUTPUT_FORCED="${OPTARG}" ;;
n) DRYRUN=true;;
h) _usage ;;
*) echo "bad option -${OPTARG}" ; _usage ;;
Expand All @@ -45,34 +45,45 @@ shift $(( ${OPTIND} - 1 ))
while [ "${*}" != "" ] ; do
INPUT="${1}"
shift
if [ -z "${OUTPUTDIR_FORCED}" ] ; then
_unset_variables
_find_input "${INPUT}"

MEDIAID=$(basename "${INPUT}" | cut -d. -f1)

if [[ -z "${OUTPUT_FORCED}" ]] ; then
[ -d "${INPUT}" ] && { OUTPUTDIR="${INPUT}/objects/access/gif" && LOGDIR="${INPUT}/metadata/logs" ;};
[ -f "${INPUT}" ] && { OUTPUTDIR=$(dirname "${INPUT}")"/access/gif" && LOGDIR="$(dirname "${INPUT}")/access/logs" ;};
[ ! "$OUTPUTDIR" ] && { OUTPUTDIR="${INPUT}/objects/access/gif" && LOGDIR="${INPUT}/metadata/logs" ;};
_set_up_output
else
OUTPUTDIR="${OUTPUTDIR_FORCED}"
LOGDIR="${OUTPUTDIR_FORCED}/logs"
if [[ -d "${OUTPUT_FORCED}" ]] ; then
OUTPUTDIR="${OUTPUT_FORCED}"
LOGDIR="${OUTPUT_FORCED}/logs"
OUTPUTDIR_FORCED="${OUTPUT_FORCED}"
_check_outputdir_forced
else
OUTPUTDIR="$(dirname "${OUTPUT_FORCED}")"
OUTPUT="${OUTPUT_FORCED}"
if [ -s "${OUTPUT}" ] ; then
_report -wt "WARNING ${OUTPUT} already exists, skipping transcode"
continue
fi
fi
fi
_unset_variables
_find_input "${INPUT}"

MEDIAID=$(basename "${INPUT}" | cut -d. -f1)
_report_to_db

# encoding options
_get_codectagstring "${SOURCEFILE}"
_get_dar "${SOURCEFILE}"
INPUTOPTIONS+=(-vsync 0)
INPUTOPTIONS+=(-nostdin)
if [[ "${CODEC_TAG_STRING}" == "mjp2" ]] ; then
INPUTOPTIONS+=(-vcodec libopenjpeg)
fi
_add_video_filter "scale=320:320/($DAR)"
_add_video_filter "scale=320:320/(${DAR})"
_add_video_filter "thumbnail=4"
MIDDLEOPTIONS+=(-frames:v 1)
echo "DAR $DAR"
MIDDLEOPTIONS+=(-update 1 -frames:v 1)
_filter_to_middle_option
_set_up_output
_log -b
DURATION=$(ffprobe 2>/dev/null "${SOURCEFILE}" -show_format | grep duration | cut -d= -f2)
_run_critical mkdir -p "${OUTPUTDIR}"
Expand All @@ -85,7 +96,6 @@ while [ "${*}" != "" ] ; do
if [ "${CONCATSOURCE}" != "" ] ; then
FFMPEGINPUT="${CONCATSOURCE}"
fi

_run_critical_event ffmpeg -nostdin -y ${INPUTOPTIONS[@]} -v warning -ss "$START" "${FFMPEGINPUT[@]}" "${MIDDLEOPTIONS[@]}" "${TEMPIMAGES}.${IMAGENUMBER}.png"
done
PALETTE="$(_maketemp)"
Expand Down

0 comments on commit fdb0983

Please sign in to comment.