speed up estimate fg

This commit is contained in:
2025-01-01 13:16:26 -06:00
parent 92e2c64db2
commit f3f6330d20
2 changed files with 14 additions and 3 deletions

View File

@@ -191,7 +191,7 @@ encode_segments() {
do do
BASE_VID="$(basename "$VIDEO")" BASE_VID="$(basename "$VIDEO")"
OUTPUT_VIDEO="$SEGMENT_DIR/encoded/encoded_${BASE_VID}" OUTPUT_VIDEO="$SEGMENT_DIR/encoded/encoded_${BASE_VID}"
encode -i "$VIDEO" -g "$GRAIN" "$OUTPUT_VIDEO" encode -P 10 -g "$GRAIN" -i "$VIDEO" "$OUTPUT_VIDEO"
BITRATE="$(get_output_bitrate "$OUTPUT_VIDEO")" BITRATE="$(get_output_bitrate "$OUTPUT_VIDEO")"
echo -e "\tgrain: $GRAIN, bitrate: $BITRATE" >> "$GRAIN_LOG" echo -e "\tgrain: $GRAIN, bitrate: $BITRATE" >> "$GRAIN_LOG"
done done

View File

@@ -15,6 +15,7 @@ usage() {
echo -e "\t[-s] use same container as input, default is mkv" echo -e "\t[-s] use same container as input, default is mkv"
echo -e "\t[-v] Print relevant version info" echo -e "\t[-v] Print relevant version info"
echo -e "\t[-g NUM] set film grain for encode" echo -e "\t[-g NUM] set film grain for encode"
echo -e "\t[-P NUM] override default preset (3)"
echo -e "\n\t[output_file] if not set, will create at $HOME/" echo -e "\n\t[output_file] if not set, will create at $HOME/"
echo -e "\n\t[-I] Install this as /usr/local/bin/encode" echo -e "\n\t[-I] Install this as /usr/local/bin/encode"
echo -e "\t[-U] Uninstall this from /usr/local/bin/encode" echo -e "\t[-U] Uninstall this from /usr/local/bin/encode"
@@ -120,7 +121,7 @@ encode() {
echo "export VIDEO_CROP=\"$VIDEO_CROP\"" >> "$ENCODE_FILE" echo "export VIDEO_CROP=\"$VIDEO_CROP\"" >> "$ENCODE_FILE"
fi fi
VIDEO_PARAMS="-pix_fmt yuv420p10le -crf 25 -preset 3 -g 240" VIDEO_PARAMS="-pix_fmt yuv420p10le -crf 25 -preset $PRESET -g 240"
echo "export VIDEO_PARAMS=\"$VIDEO_PARAMS\"" >> "$ENCODE_FILE" echo "export VIDEO_PARAMS=\"$VIDEO_PARAMS\"" >> "$ENCODE_FILE"
CONVERT_SUBS="$(convert_subs)" CONVERT_SUBS="$(convert_subs)"
@@ -177,13 +178,14 @@ encode() {
fi fi
} }
OPTS='vi:pcsg:IU' OPTS='vi:pcsg:P:IU'
NUM_OPTS="${#OPTS}" NUM_OPTS="${#OPTS}"
# default values # default values
CROP='false' CROP='false'
PRINT_OUT="false" PRINT_OUT="false"
SAME_CONTAINER="false" SAME_CONTAINER="false"
GRAIN="" GRAIN=""
PRESET=3
# only using -I/U # only using -I/U
MIN_OPT=1 MIN_OPT=1
# using all + output name # using all + output name
@@ -247,6 +249,15 @@ while getopts "$OPTS" flag; do
GRAIN="film-grain=${OPTARG}:film-grain-denoise=1:adaptive-film-grain=1:" GRAIN="film-grain=${OPTARG}:film-grain-denoise=1:adaptive-film-grain=1:"
OPTS_USED=$((OPTS_USED + 2)) OPTS_USED=$((OPTS_USED + 2))
;; ;;
P)
if [[ ${OPTARG} != ?(-)+([[:digit:]]) || ${OPTARG} -lt 0 ]]; then
echo "${OPTARG} is not a positive integer"
usage
exit 1
fi
PRESET="${OPTARG}"
OPTS_USED=$((OPTS_USED + 2))
;;
*) *)
echo "wrong flags given" echo "wrong flags given"
usage usage