Added unsharp filter.
parent
5742812bc2
commit
e0bce02bba
51
convmlv.sh
51
convmlv.sh
|
@ -140,6 +140,8 @@ setDefaults() { #Set all the default variables. Run here, and also after each AR
|
||||||
hqDesc=""
|
hqDesc=""
|
||||||
REM_NOISE="" #removegrain noise reduction
|
REM_NOISE="" #removegrain noise reduction
|
||||||
remDesc=""
|
remDesc=""
|
||||||
|
SHARP=""
|
||||||
|
sharpDesc=""
|
||||||
}
|
}
|
||||||
|
|
||||||
setDefaults #Run now, but also later.
|
setDefaults #Run now, but also later.
|
||||||
|
@ -261,6 +263,15 @@ OPTIONS, COLOR:
|
||||||
-w [0:2] WHITE - This is a modal white balance setting.
|
-w [0:2] WHITE - This is a modal white balance setting.
|
||||||
--> 0: Auto WB. 1: Camera WB (default). 2: No Change.
|
--> 0: Auto WB. 1: Camera WB (default). 2: No Change.
|
||||||
|
|
||||||
|
-A [i:i:i:i] SHARP - Lets you sharpen, or blur, your footage.
|
||||||
|
--> Size/Strength (S/T). S is the size of the sharpen/blur effect, T is the strength of the sharpen/blur effect.
|
||||||
|
--> Luma/Chroma (L/C). L is the detail, C is the color. Luma sharpening more effective.
|
||||||
|
--> Tip: Chroma blur can actually be a helpful noise reduction technique.
|
||||||
|
|
||||||
|
--> Option Value: <LS>:<LT>:<CS>:<CT>
|
||||||
|
--> LS and CS must be ODD, between 3 and 63. Negative LT/CT values blur, while positive ones sharpen.
|
||||||
|
--> Strong Sharp: 7:3:7:3 Strong Blur: 7,-3:7,-3
|
||||||
|
|
||||||
-l <path> LUT - Specify a LUT to apply.
|
-l <path> LUT - Specify a LUT to apply.
|
||||||
--> Supports cube, 3dl, dat, m3d.
|
--> Supports cube, 3dl, dat, m3d.
|
||||||
|
|
||||||
|
@ -560,6 +571,18 @@ evalConf() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
"SHARP")
|
||||||
|
val=`echo "${line}" | cut -d$' ' -f2`
|
||||||
|
|
||||||
|
lSize=`echo "${val}" | cut -d$':' -f1`
|
||||||
|
lStr=`echo "${val}" | cut -d$':' -f2`
|
||||||
|
cSize=`echo "${val}" | cut -d$':' -f3`
|
||||||
|
cStr=`echo "${val}" | cut -d$':' -f4`
|
||||||
|
|
||||||
|
SHARP="unsharp=${lSize}:${lSize}:${lStr}:${cSize}:${cSize}:${cStr}"
|
||||||
|
sharpDesc="Sharpen/Blur"
|
||||||
|
FFMPEG_FILTERS=true
|
||||||
|
;;
|
||||||
"LUT")
|
"LUT")
|
||||||
LUT_PATH=`echo "${line}" | cut -d$' ' -f2`
|
LUT_PATH=`echo "${line}" | cut -d$' ' -f2`
|
||||||
|
|
||||||
|
@ -603,7 +626,7 @@ parseArgs() { #Amazing new argument parsing!!!
|
||||||
longArg() { #Creates VAL
|
longArg() { #Creates VAL
|
||||||
ret="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
|
ret="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
|
||||||
}
|
}
|
||||||
while getopts "vh C: o:P: T: i t: m p: s: k r: d: f H: c: n: N: Q: G: g: w: l: S: D u b a: F: R: q K Y M -:" opt; do
|
while getopts "vh C: o:P: T: i t: m p: s: k r: d: f H: c: n: N: Q: G: g: w: A: l: S: D u b a: F: R: q K Y M -:" opt; do
|
||||||
#~ echo $opt ${OPTARG}
|
#~ echo $opt ${OPTARG}
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
-) #Long Arguments
|
-) #Long Arguments
|
||||||
|
@ -857,6 +880,18 @@ parseArgs() { #Amazing new argument parsing!!!
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
A)
|
||||||
|
val=${OPTARG}
|
||||||
|
|
||||||
|
lSize=`echo "${val}" | cut -d$':' -f1`
|
||||||
|
lStr=`echo "${val}" | cut -d$':' -f2`
|
||||||
|
cSize=`echo "${val}" | cut -d$':' -f3`
|
||||||
|
cStr=`echo "${val}" | cut -d$':' -f4`
|
||||||
|
|
||||||
|
SHARP="unsharp=${lSize}:${lSize}:${lStr}:${cSize}:${cSize}:${cStr}"
|
||||||
|
sharpDesc="Sharpen/Blur"
|
||||||
|
FFMPEG_FILTERS=true
|
||||||
|
;;
|
||||||
l)
|
l)
|
||||||
LUT_PATH=${OPTARG}
|
LUT_PATH=${OPTARG}
|
||||||
if [ ! -f $LUT_PATH ]; then
|
if [ ! -f $LUT_PATH ]; then
|
||||||
|
@ -1121,11 +1156,11 @@ for ARG in "${FILE_ARGS_ITER[@]}"; do #Go through FILE_ARGS_ITER array, copied f
|
||||||
#Construct the FFMPEG filters.
|
#Construct the FFMPEG filters.
|
||||||
if [[ $FFMPEG_FILTERS == true ]]; then
|
if [[ $FFMPEG_FILTERS == true ]]; then
|
||||||
FINAL_SCALE="scale=trunc(iw/2)*${SCALE}:trunc(ih/2)*${SCALE}"
|
FINAL_SCALE="scale=trunc(iw/2)*${SCALE}:trunc(ih/2)*${SCALE}"
|
||||||
V_FILTERS="-vf $(joinArgs , ${DESHAKE} ${TEMP_NOISE} ${HQ_NOISE} ${REM_NOISE} ${LUT})"
|
V_FILTERS="-vf $(joinArgs , ${HQ_NOISE} ${TEMP_NOISE} ${REM_NOISE} ${DESHAKE} ${SHARP} ${LUT})"
|
||||||
V_FILTERS_PROX="-vf $(joinArgs , ${DESHAKE} ${TEMP_NOISE} ${HQ_NOISE} ${REM_NOISE} ${LUT} ${FINAL_SCALE})" #Proxy filter set adds the scale component.
|
V_FILTERS_PROX="-vf $(joinArgs , ${HQ_NOISE} ${TEMP_NOISE} ${REM_NOISE} ${DESHAKE} ${SHARP} ${LUT} ${FINAL_SCALE})" #Proxy filter set adds the scale component.
|
||||||
|
|
||||||
#Created formatted array of filters, FILTER_ARR.
|
#Created formatted array of filters, FILTER_ARR.
|
||||||
declare -a compFilters=("${tempDesc}" "${lutDesc}" "${deshakeDesc}" "${hqDesc}" "${remDesc}")
|
declare -a compFilters=("${hqDesc}" "${tempDesc}" "${remDesc}" "${deshakeDesc}" "${sharpDesc}" "${lutDesc}")
|
||||||
for v in "${compFilters[@]}"; do if test "$v"; then FILTER_ARR+=("$v"); fi; done
|
for v in "${compFilters[@]}"; do if test "$v"; then FILTER_ARR+=("$v"); fi; done
|
||||||
fi
|
fi
|
||||||
#Evaluate convmlv.conf configuration file for file-specific blocks.
|
#Evaluate convmlv.conf configuration file for file-specific blocks.
|
||||||
|
@ -1720,14 +1755,14 @@ for ARG in "${FILE_ARGS_ITER[@]}"; do #Go through FILE_ARGS_ITER array, copied f
|
||||||
echo -e "\e[1mApplying Filters:\e[0m $(joinArgs ", " "${FILTER_ARR[@]}")...\n"
|
echo -e "\e[1mApplying Filters:\e[0m $(joinArgs ", " "${FILTER_ARR[@]}")...\n"
|
||||||
|
|
||||||
if [ $IMG_FMT == "exr" ]; then
|
if [ $IMG_FMT == "exr" ]; then
|
||||||
echo -e "Note: EXRs may hang after filtering.\n"
|
echo -e "Note: EXR filtering lags before and after processing.\n"
|
||||||
|
|
||||||
img_res=$(identify ${SEQ}/${TRUNC_ARG}_$(printf "%06d" $(echo "$FRAME_START" | bc)).${IMG_FMT} | cut -d$' ' -f3)
|
img_res=$(identify ${SEQ}/${TRUNC_ARG}_$(printf "%06d" $(echo "$FRAME_START" | bc)).${IMG_FMT} | cut -d$' ' -f3)
|
||||||
|
|
||||||
convert "${SEQ}/${TRUNC_ARG}_%06d.exr[${FRAME_START}-${FRAME_END}]" -define stream:buffer-size=0 -set colorspace RGB ppm:- | \
|
convert "${SEQ}/${TRUNC_ARG}_%06d.exr[${FRAME_START}-${FRAME_END}]" -set colorspace RGB dpx:- | \
|
||||||
ffmpeg -f image2pipe -vcodec ppm -s "${img_res}" -r $FPS -loglevel panic -stats -i pipe:0 \
|
ffmpeg -f image2pipe -vcodec dpx -s "${img_res}" -r $FPS -stats -i pipe:0 \
|
||||||
$V_FILTERS \
|
$V_FILTERS \
|
||||||
-vcodec ppm -n -r $FPS -f image2pipe pipe:1 | \
|
-vcodec dpx -n -r $FPS -f image2pipe pipe:1 | \
|
||||||
convert -depth 16 - -colorspace RGB -compress piz -set colorspace RGB "${tmpFiltered}/%06d.${IMG_FMT}"
|
convert -depth 16 - -colorspace RGB -compress piz -set colorspace RGB "${tmpFiltered}/%06d.${IMG_FMT}"
|
||||||
#For some reason, this whole process sends EXR's into sRGB. That's why -colorspace RGB is specified. See Nasty Hacks.
|
#For some reason, this whole process sends EXR's into sRGB. That's why -colorspace RGB is specified. See Nasty Hacks.
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue