Added atadenoise, completely supports -vf ffmpeg filters now. Discovered colorspace bug.
parent
65cfb52af0
commit
784437b9e1
|
@ -1,4 +1,10 @@
|
|||
[code]
|
||||
[b]v1.9.1[/b]: [url=https://bitbucket.org/so-rose/convmlv/src]https://bitbucket.org/so-rose/convmlv/src[/url]
|
||||
[size=8pt]*Fully Supported Config Files! Check the help page; all options for which this makes sense can be specified in global, local, or file-specific config files.[/size]
|
||||
[size=8pt]*File-Specific Blocks: With this, just make one config file w/any special options per file, and you're done. Huge time saver in production situations![/size]
|
||||
[size=8pt]*Create Darkframes: You no longer have to create your averaged .darkframe files yourself. 'convmlv -R df <MLV FILE>' creates a file named df.darkframe; -F develops using it.[/size]
|
||||
[size=8pt]*DNG Improvements: It works now (that's nice :) ), but settings.txt is also created properly now. Plus, bug fixes abound![/size]
|
||||
|
||||
[b]v1.9.0[/b]: [url=https://bitbucket.org/so-rose/convmlv/src]https://bitbucket.org/so-rose/convmlv/src[/url]
|
||||
[size=8pt]*Sane Argument Parsing! You can now choose to use spaces![/size]
|
||||
[size=8pt]*DNG: Multithreaded mlv_dump with progress bar![/size]
|
||||
|
|
87
README.md
87
README.md
|
@ -19,7 +19,7 @@ INFO:
|
|||
-->Acceptable Inputs: MLV, RAW, DNG Folder.
|
||||
-->Option Input: From command line or config file.
|
||||
|
||||
VERSION: 1.9.1
|
||||
VERSION: 1.9.2
|
||||
|
||||
MANUAL DEPENDENCIES:
|
||||
-mlv_dump: Required. http://www.magiclantern.fm/forum/index.php?topic=7122.0
|
||||
|
@ -54,6 +54,7 @@ OPTIONS, OUTPUT:
|
|||
|
||||
-t [0:3] IMG_FMT - Specified image output format.
|
||||
--> 0: EXR (default), 1: TIFF, 2: PNG, 3: Cineon (DPX)."
|
||||
--> Note: Only EXR supports Linear output. Specify -g 3 if not using EXR.
|
||||
|
||||
-m MOVIE - Will output a Prores4444 file.
|
||||
|
||||
|
@ -91,8 +92,12 @@ OPTIONS, RAW DEVELOPMENT:
|
|||
--> 0: None (default). 1: 2x2. 2: 3x3. 3: 5x5.
|
||||
--> MLV Only.
|
||||
|
||||
-n [int] NOISE_REDUC - Apply wavelet denoising.
|
||||
--> Default: None. Subtle: 50. Medium: 100. Strong: 200.
|
||||
-n [int] WAVE_NOISE - Apply wavelet denoising.
|
||||
--> Default: None. Subtle: 25. Medium: 50. Strong: 125.
|
||||
|
||||
-N <A>-<B> TEMP_NOISE - Apply temporal denoising.
|
||||
--> A: 0 to 0.3. B: 0 to 5. A reacts to abrupt noise (splotches), B reacts to noise over time (fast motion causes artifacts).
|
||||
--> Subtle: 0.03-0.04. High: 0.15-0.04. High, Predictable Motion: 0.15-0.07
|
||||
|
||||
-g [0:4] SPACE - Output color transformation.
|
||||
--> 0: Linear. 1: 2.2 (Adobe RGB). 2: 1.8 (ProPhoto RGB). 3: sRGB. 4: BT.709.
|
||||
|
@ -104,6 +109,82 @@ OPTIONS, COLOR:
|
|||
-w [0:2] WHITE - This is a modal white balance setting.
|
||||
--> 0: Auto WB. 1: Camera WB (default). 2: No Change.
|
||||
|
||||
-l <path> LUT - Specify a LUT to apply.
|
||||
--> Supports cube, 3dl, dat, m3d.
|
||||
|
||||
-S [int] SATPOINT - Specify the 14-bit saturation point of your camera.
|
||||
--> Lower if -H1 yields purple highlights. Must be correct for highlight reconstruction.
|
||||
--> Determine using the max value of 'dcraw -D -j -4 -T'
|
||||
|
||||
--white-speed [int] WHITE_SPD - Samples used to calculate AWB
|
||||
|
||||
--allow-white-clip WHITE_CLIP - Let White Balance multipliers clip.
|
||||
|
||||
|
||||
OPTIONS, FEATURES:
|
||||
-u DUAL_ISO - Process as dual ISO.
|
||||
|
||||
-b BADPIXELS - Fix focus pixels issue using dfort's script.
|
||||
|
||||
-a <path> BADPIXEL_PATH - Use your own .badpixels file.
|
||||
--> How to: http://www.dl-c.com/board/viewtopic.php?f=4&t=686
|
||||
|
||||
-F <path> DARKFRAME - This is the path to a "dark frame MLV"; effective for noise reduction.
|
||||
--> How to: Record 5 sec w/lens cap on & same settings as footage. Pass MLV in here.
|
||||
--> If the file extension is '.darkframe', the file will be used as the preaveraged dark frame.
|
||||
|
||||
-R <path> dark_out - Specify to create a .darkframe file from passed in MLV.
|
||||
--> Outputs <arg>.darkframe file to <path>.
|
||||
--> THE .darkframe EXTENSION IS ADDED FOR YOU.
|
||||
|
||||
|
||||
OPTIONS, INFO:
|
||||
-q Output MLV settings.
|
||||
|
||||
-K Debian Package Deps - Output package dependecies.
|
||||
--> Install (Debian only): sudo apt-get install $ (./convmlv -K)
|
||||
|
||||
-Y Python Deps - Lists Python dependencies. Works directly with pip.
|
||||
-->Install (Linux): sudo pip3 install $ (./convmlv -Y)
|
||||
|
||||
-M Manual Deps - Lists manual dependencies, which must be downloaded by hand.
|
||||
--> There's no automatic way to install these. See http://www.magiclantern.fm/forum/index.php?topic=16799.0 .
|
||||
|
||||
CONFIG FILE:
|
||||
You do not need to type in all the arguments each time: Config files, another way to specify options, can save you time & lend
|
||||
you convenience in production situations.
|
||||
|
||||
GLOBAL: /home/sofus/convmlv.conf
|
||||
LOCAL: Specify -C/--config.
|
||||
|
||||
Some options have an uppercased VARNAME, ex. OUTDIR. In a convmlv config file, you can specify this option
|
||||
in the following format, line by line:
|
||||
<VARNAME> <VALUE>
|
||||
|
||||
If the value is a true/false flag, simply specifying VARNAME is enough. Otherwise, normal rules for the value applies.
|
||||
|
||||
Options override each other as such:
|
||||
-LOCAL overrides GLOBAL config.
|
||||
-Passed arguments override both configs.
|
||||
-Lines starting with # are comments.
|
||||
-Name a config using the VARNAME: CONFIG_NAME <name>
|
||||
|
||||
|
||||
File-Specific Block: A LOCAL config file lets you specify options for specific input names:
|
||||
/ <TRUNCATED INPUTNAME>
|
||||
...specify options
|
||||
*
|
||||
|
||||
File-Specific Blocks override all other options. This allows one to create
|
||||
a single config file to batch-develop several input files/folders at once, after deciding how each one should
|
||||
look/be configured individually.
|
||||
|
||||
Notes on Usage:
|
||||
-You must use the truncated (no .mlv or .raw) input name after the /.
|
||||
-No nested blocks.
|
||||
-Indentation by tabs or spaces is allowed, but not enforced. -w [0:2] WHITE - This is a modal white balance setting.
|
||||
--> 0: Auto WB. 1: Camera WB (default). 2: No Change.
|
||||
|
||||
-l <path> LUT - Specify a LUT to apply.
|
||||
--> Supports cube, 3dl, dat, m3d.
|
||||
--> LUT cannot be applied to EXR sequences.
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
CONFIG_NAME atadenoise-test
|
||||
|
||||
# Comments start with #. See 'convmlv -h' for option documentation.
|
||||
|
||||
### <------------------ BASIC OPTIONS ------------------>
|
||||
OUTDIR ./raw_conv
|
||||
#RES_PATH /home/sofus/subhome/src/convmlv
|
||||
|
||||
MLV_DUMP /home/sofus/subhome/src/convmlv/mlv_dump
|
||||
RAW_DUMP /home/sofus/subhome/src/convmlv/raw2dng
|
||||
MLV_BP /home/sofus/subhome/src/convmlv/mlv2badpixels.sh
|
||||
CR_HDR /home/sofus/subhome/src/convmlv/cr2hdr
|
||||
SRANGE /home/sofus/subhome/src/convmlv/sRange.py
|
||||
BAL /home/sofus/subhome/src/convmlv/balance.py
|
||||
PYTHON python3
|
||||
|
||||
#~ THREADS 1
|
||||
|
||||
### <------------------ OUTPUT OPTIONS ------------------>
|
||||
IMAGE
|
||||
IMG_FMT 0
|
||||
|
||||
#~ MOVIE
|
||||
|
||||
PROXY 0
|
||||
#~ PROXY_SCALE 50%
|
||||
|
||||
KEEP_DNGS
|
||||
|
||||
FRAME_RANGE 300-350
|
||||
#UNCOMP
|
||||
|
||||
### <------------------ RAW OPTIONS ------------------>
|
||||
|
||||
DEMO_MODE 2
|
||||
|
||||
HIGHLIGHT_MODE 0
|
||||
#~ TEMP_NOISE 0.15-0.04
|
||||
|
||||
SPACE 0
|
||||
|
||||
### <------------------ COLOR OPTIONS ------------------>
|
||||
|
||||
WHITE 1
|
||||
|
||||
### <------------------ FEATURE OPTIONS ------------------>
|
||||
|
||||
#DARKFRAME ./df.darkframe
|
||||
#~ LUT /home/sofus/subhome/src/convmlv/test_footage/girl_lut_test.cube
|
|
@ -22,7 +22,7 @@ DEMO_MODE 3
|
|||
HIGHLIGHT_MODE 0
|
||||
|
||||
CHROMA_SMOOTH 1
|
||||
NOISE_REDUC 50
|
||||
WAVE_NOISE 50
|
||||
|
||||
SPACE 0
|
||||
#SHALLOW
|
||||
|
|
|
@ -11,7 +11,7 @@ FRAME_RANGE s-e
|
|||
/ cool_files
|
||||
MOVIE
|
||||
FRAME_RANGE 1-10
|
||||
NOISE_REDUC 50
|
||||
WAVE_NOISE 50
|
||||
*
|
||||
/ 700D_mv1080_1728x1158
|
||||
IMAGE
|
||||
|
|
|
@ -38,9 +38,10 @@ DEMO_MODE 3
|
|||
HIGHLIGHT_MODE 0
|
||||
|
||||
CHROMA_SMOOTH 1
|
||||
NOISE_REDUC 50
|
||||
WAVE_NOISE 50
|
||||
TEMP_NOISE 0.03-0.04
|
||||
|
||||
SPACE 0
|
||||
SPACE 3
|
||||
#SHALLOW
|
||||
|
||||
### <------------------ COLOR OPTIONS ------------------>
|
||||
|
|
141
convmlv.sh
141
convmlv.sh
|
@ -9,6 +9,7 @@
|
|||
#~ --> A different module (like -e) for live viewing of footage, under convmlv settings. Danne is working on this :).
|
||||
|
||||
#BUG: Relative OUTDIR makes baxpixel generation fail if ./mlv2badpixels.sh doesn't exist. Fixed on Linux only.
|
||||
#BUG: Colorspace Bug Affecting all but EXR output.
|
||||
|
||||
|
||||
#~ The MIT License (MIT)
|
||||
|
@ -34,7 +35,7 @@
|
|||
#~ SOFTWARE.
|
||||
|
||||
#BASIC VARS
|
||||
VERSION="1.9.1" #Version string.
|
||||
VERSION="1.9.2" #Version string.
|
||||
INPUT_ARGS=$(echo "$@") #The original input argument string.
|
||||
|
||||
if [[ $OSTYPE == "linux-gnu" ]]; then
|
||||
|
@ -103,7 +104,7 @@ setDefaults() { #Set all the default variables. Run here, and also after each AR
|
|||
SPACE="0" #Color Space. Correlates to Gamma.
|
||||
DEPTH="-W -6"
|
||||
DEPTH_OUT="-depth 16"
|
||||
NOISE_REDUC=""
|
||||
WAVE_NOISE="" #Used to be NOISE_REDUC. Wavelet noise reduction.
|
||||
FOUR_COLOR=""
|
||||
CHROMA_SMOOTH="--no-cs"
|
||||
|
||||
|
@ -126,7 +127,10 @@ setDefaults() { #Set all the default variables. Run here, and also after each AR
|
|||
isScale=false
|
||||
SATPOINT=""
|
||||
|
||||
#LUT
|
||||
#FFMPEG Filters
|
||||
FFMPEG_FILTERS=false #Whether or not FFMPEG filters are going to be used.
|
||||
TEMP_NOISE="" #Temporal noise reduction.
|
||||
isTemp=false
|
||||
LUT=""
|
||||
isLUT=false
|
||||
}
|
||||
|
@ -179,6 +183,7 @@ OPTIONS, OUTPUT:
|
|||
|
||||
-t [0:3] IMG_FMT - Specified image output format.
|
||||
--> 0: EXR (default), 1: TIFF, 2: PNG, 3: Cineon (DPX)."
|
||||
--> Note: Only EXR supports Linear output. Specify -g 3 if not using EXR.
|
||||
|
||||
-m MOVIE - Will output a Prores4444 file.
|
||||
|
||||
|
@ -216,8 +221,12 @@ OPTIONS, RAW DEVELOPMENT:
|
|||
--> 0: None (default). 1: 2x2. 2: 3x3. 3: 5x5.
|
||||
--> MLV Only.
|
||||
|
||||
-n [int] NOISE_REDUC - Apply wavelet denoising.
|
||||
--> Default: None. Subtle: 50. Medium: 100. Strong: 200.
|
||||
-n [int] WAVE_NOISE - Apply wavelet denoising.
|
||||
--> Default: None. Subtle: 25. Medium: 50. Strong: 125.
|
||||
|
||||
-N <A>-<B> TEMP_NOISE - Apply temporal denoising.
|
||||
--> A: 0 to 0.3. B: 0 to 5. A reacts to abrupt noise (splotches), B reacts to noise over time (fast motion causes artifacts).
|
||||
--> Subtle: 0.03-0.04. High: 0.15-0.04. High, Predictable Motion: 0.15-0.07
|
||||
|
||||
-g [0:4] SPACE - Output color transformation.
|
||||
--> 0: Linear. 1: 2.2 (Adobe RGB). 2: 1.8 (ProPhoto RGB). 3: sRGB. 4: BT.709.
|
||||
|
@ -231,7 +240,6 @@ OPTIONS, COLOR:
|
|||
|
||||
-l <path> LUT - Specify a LUT to apply.
|
||||
--> Supports cube, 3dl, dat, m3d.
|
||||
--> LUT cannot be applied to EXR sequences.
|
||||
|
||||
-S [int] SATPOINT - Specify the 14-bit saturation point of your camera.
|
||||
--> Lower if -H1 yields purple highlights. Must be correct for highlight reconstruction.
|
||||
|
@ -268,7 +276,7 @@ OPTIONS, INFO:
|
|||
-Y Python Deps - Lists Python dependencies. Works directly with pip.
|
||||
-->Install (Linux): sudo pip3 install $ (./convmlv -Y)
|
||||
|
||||
-N Manual Deps - Lists manual dependencies, which must be downloaded by hand.
|
||||
-M Manual Deps - Lists manual dependencies, which must be downloaded by hand.
|
||||
--> There's no automatic way to install these. See http://www.magiclantern.fm/forum/index.php?topic=16799.0 .
|
||||
|
||||
CONFIG FILE:
|
||||
|
@ -304,9 +312,6 @@ CONFIG FILE:
|
|||
-You must use the truncated (no .mlv or .raw) input name after the /.
|
||||
-No nested blocks.
|
||||
-Indentation by tabs or spaces is allowed, but not enforced.
|
||||
|
||||
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -442,7 +447,17 @@ evalConf() {
|
|||
;;
|
||||
esac
|
||||
;;
|
||||
"NOISE_REDUC") NOISE_REDUC="-n $(echo "${line}" | cut -d$' ' -f2)"
|
||||
"WAVE_NOISE") WAVE_NOISE="-n $(echo "${line}" | cut -d$' ' -f2)"
|
||||
;;
|
||||
"TEMP_NOISE")
|
||||
vals="$(echo "${line}" | cut -d$' ' -f2)"
|
||||
|
||||
aVal=$(echo "${vals}" | cut -d"-" -f1)
|
||||
bVal=$(echo "${vals}" | cut -d"-" -f2)
|
||||
|
||||
TEMP_NOISE="atadenoise=0a=${aVal}:0b=${bVal}:1a=${aVal}:1b=${bVal}:2a=${aVal}:2b=${bVal}"
|
||||
isTemp=true
|
||||
FFMPEG_FILTERS=true
|
||||
;;
|
||||
"SPACE")
|
||||
mode=`echo "${line}" | cut -d$' ' -f2`
|
||||
|
@ -484,13 +499,16 @@ evalConf() {
|
|||
;;
|
||||
"LUT")
|
||||
LUT_PATH=`echo "${line}" | cut -d$' ' -f2`
|
||||
|
||||
if [ ! -f $LUT_PATH ]; then
|
||||
echo "LUT not found!!!"
|
||||
echo $LUT_PATH
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LUT="lut3d=${LUT_PATH}"
|
||||
isLUT=true
|
||||
FFMPEG_FILTERS=true
|
||||
;;
|
||||
"SATPOINT") SATPOINT="-S $(echo "${line}" | cut -d$' ' -f2)"
|
||||
;;
|
||||
|
@ -517,7 +535,7 @@ parseArgs() { #Amazing new argument parsing!!!
|
|||
longArg() { #Creates VAL
|
||||
ret="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
|
||||
}
|
||||
while getopts "vh C: o:P: T: i t: m p: s: k r: d: f H: c: n: g: w: l: S: u b a: F: R: q K Y N -:" opt; do
|
||||
while getopts "vh C: o:P: T: i t: m p: s: k r: d: f H: c: n: N: g: w: l: S: u b a: F: R: q K Y M -:" opt; do
|
||||
#~ echo $opt ${OPTARG}
|
||||
case "$opt" in
|
||||
-) #Long Arguments
|
||||
|
@ -694,7 +712,17 @@ parseArgs() { #Amazing new argument parsing!!!
|
|||
esac
|
||||
;;
|
||||
n)
|
||||
NOISE_REDUC="-n ${OPTARG}"
|
||||
WAVE_NOISE="-n ${OPTARG}"
|
||||
;;
|
||||
N)
|
||||
vals=${OPTARG}
|
||||
|
||||
aVal=$(echo "${vals}" | cut -d"-" -f1)
|
||||
bVal=$(echo "${vals}" | cut -d"-" -f2)
|
||||
|
||||
TEMP_NOISE="atadenoise=0a=${aVal}:0b=${bVal}:1a=${aVal}:1b=${bVal}:2a=${aVal}:2b=${bVal}"
|
||||
isTemp=true
|
||||
FFMPEG_FILTERS=true
|
||||
;;
|
||||
g)
|
||||
mode=${OPTARG}
|
||||
|
@ -772,12 +800,13 @@ parseArgs() { #Amazing new argument parsing!!!
|
|||
;;
|
||||
K)
|
||||
echo $DEB_DEPS
|
||||
exit 0
|
||||
;;
|
||||
Y)
|
||||
echo $PIP_DEPS
|
||||
exit 0
|
||||
;;
|
||||
N)
|
||||
M)
|
||||
echo $MAN_DEPS
|
||||
exit 0
|
||||
;;
|
||||
|
@ -982,8 +1011,16 @@ for ARG in "${FILE_ARGS_ITER[@]}"; do #Go through FILE_ARGS_ITER array, copied f
|
|||
BASE="$(basename "$ARG")"
|
||||
EXT="${BASE##*.}"
|
||||
TRUNC_ARG="${BASE%.*}"
|
||||
SCALE=`echo "($(echo "${PROXY_SCALE}" | sed 's/%//') / 100) * 2" | bc -l` #Get scale as factor for halved video, *2 for 50%
|
||||
setBL=true
|
||||
|
||||
joinArgs() { local IFS="$1"; shift; echo "$*"; }
|
||||
|
||||
#Construct the FFMPEG filters.
|
||||
FINAL_SCALE="scale=trunc(iw/2)*${SCALE}:trunc(ih/2)*${SCALE}"
|
||||
V_FILTERS="-vf $(joinArgs , ${TEMP_NOISE} ${LUT})"
|
||||
V_FILTERS_PROX="-vf $(joinArgs , ${TEMP_NOISE} ${LUT} ${proxy_scale})" #Proxy filters add the scale component.
|
||||
|
||||
#Evaluate convmlv.conf configuration file for file-specific blocks.
|
||||
evalConf "$LCONFIG" true
|
||||
#Check that things exist.
|
||||
|
@ -1073,7 +1110,7 @@ for ARG in "${FILE_ARGS_ITER[@]}"; do #Go through FILE_ARGS_ITER array, copied f
|
|||
fi
|
||||
}
|
||||
|
||||
#Manage if it's a DNG argument, reused or not. Also, create FILE and TMP.
|
||||
#DNG argument, reused or not. Also, create FILE and TMP.
|
||||
DEVELOP=true
|
||||
if [[ ( -d $ARG ) && ( ( `basename ${ARG} | cut -c1-3` == "dng" && -f "${ARG}/../settings.txt" ) || ( `basename ${ARG}` == $TRUNC_ARG && -f "${ARG}/settings.txt" ) ) ]]; then #If we're reusing a dng sequence, copy over before we delete the original.
|
||||
echo -e "\e[1m${TRUNC_ARG}:\e[0m Moving DNGs from previous run...\n" #Use prespecified DNG sequence.
|
||||
|
@ -1445,7 +1482,7 @@ for ARG in "${FILE_ARGS_ITER[@]}"; do #Go through FILE_ARGS_ITER array, copied f
|
|||
|
||||
dcrawOpt() { #Find, develop, and splay raw DNG data as ppm, ready to be processed.
|
||||
find "${TMP}" -maxdepth 1 -iname "*.dng" -print0 | sort -z | tr -d "\n" | xargs -0 \
|
||||
dcraw -c -q $DEMO_MODE $FOUR_COLOR -k $BLACK_LEVEL $SATPOINT $BADPIXELS $WHITE -H $HIGHLIGHT_MODE -g $GAMMA $NOISE_REDUC -o $SPACE $DEPTH
|
||||
dcraw -c -q $DEMO_MODE $FOUR_COLOR -k $BLACK_LEVEL $SATPOINT $BADPIXELS $WHITE -H $HIGHLIGHT_MODE -g $GAMMA $WAVE_NOISE -o $SPACE $DEPTH
|
||||
} #Is prepared to pipe all the files in TMP outwards.
|
||||
|
||||
dcrawImg() { #Find and splay image sequence data as ppm, ready to be processed by ffmpeg.
|
||||
|
@ -1454,12 +1491,12 @@ for ARG in "${FILE_ARGS_ITER[@]}"; do #Go through FILE_ARGS_ITER array, copied f
|
|||
|
||||
mov_main() {
|
||||
ffmpeg -f image2pipe -vcodec ppm -r $FPS -i pipe:0 \
|
||||
-loglevel panic -stats $SOUND -vcodec prores_ks -n -r $FPS -profile:v 4444 -alpha_bits 0 -vendor ap4h $LUT $SOUND_ACTION "${VID}_hq.mov"
|
||||
-loglevel panic -stats $SOUND -vcodec prores_ks -n -r $FPS -profile:v 4444 -alpha_bits 0 -vendor ap4h $V_FILTERS $SOUND_ACTION "${VID}_hq.mov"
|
||||
} #-loglevel panic -stats
|
||||
|
||||
mov_prox() {
|
||||
ffmpeg -f image2pipe -vcodec ppm -r $FPS -i pipe:0 \
|
||||
-loglevel panic -stats $SOUND -c:v libx264 -n -r $FPS -preset fast -vf "scale=trunc(iw/2)*${SCALE}:trunc(ih/2)*${SCALE}" -crf 23 $LUT -c:a mp3 "${VID}_lq.mp4"
|
||||
-loglevel panic -stats $SOUND -c:v libx264 -n -r $FPS -preset fast $V_FILTERS_PROX -crf 23 -c:a mp3 "${VID}_lq.mp4"
|
||||
} #The option -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" fixes when x264 is unhappy about non-2 divisible dimensions.
|
||||
|
||||
runSim() {
|
||||
|
@ -1485,19 +1522,19 @@ for ARG in "${FILE_ARGS_ITER[@]}"; do #Go through FILE_ARGS_ITER array, copied f
|
|||
#~ cat $PIPE | tr 'e' 'a' & echo 'hello' | tee $PIPE | tr 'e' 'o' #The magic of simultaneous execution ^_^
|
||||
}
|
||||
|
||||
img_par() { #Takes 20 arguments: {} 2$DEMO_MODE 3$FOUR_COLOR 4$BADPIXELS 5$WHITE 6$HIGHLIGHT_MODE 7$GAMMA 8$NOISE_REDUC 9$DEPTH 10$SEQ 11$TRUNC_ARG 12$IMG_FMT 13$FRAME_END 14$DEPTH_OUT 15$COMPRESS 16$isJPG 17$PROXY_SCALE 18$PROXY 19$BLACK_LEVEL 20$SPACE 21$SATPOINT
|
||||
img_par() { #Takes 20 arguments: {} 2$DEMO_MODE 3$FOUR_COLOR 4$BADPIXELS 5$WHITE 6$HIGHLIGHT_MODE 7$GAMMA 8$WAVE_NOISE 9$DEPTH 10$SEQ 11$TRUNC_ARG 12$IMG_FMT 13$FRAME_END 14$DEPTH_OUT 15$COMPRESS 16$isJPG 17$PROXY_SCALE 18$PROXY 19$BLACK_LEVEL 20$SPACE 21$SATPOINT
|
||||
count=$(echo $(echo $1 | rev | cut -d "_" -f 1 | rev | cut -d "." -f 1 | grep "[0-9]") | bc) #Instead of count from file, count from name!
|
||||
if [ ${16} == true ]; then
|
||||
dcraw -c -q $2 $3 $4 $5 -H $6 -k ${19} ${21} -g $7 $8 -o ${20} $9 $1 | \
|
||||
tee >(convert ${14} - ${15} $(printf "${10}/${11}_%06d.${12}" ${count})) | \
|
||||
convert - -quality 90 -resize ${17} $(printf "${18}/${11}_%06d.jpg" ${count})
|
||||
tee >(convert ${14} - ${15} -set colorspace RGB -set colorspace RGB $(printf "${10}/${11}_%06d.${12}" ${count})) | \
|
||||
convert - -quality 90 -set colorspace RGB -resize ${17} -set colorspace RGB $(printf "${18}/${11}_%06d.jpg" ${count})
|
||||
echo -e "\e[2K\rDNG to ${12^^}/JPG: Frame ${count^^}/${13}\c"
|
||||
else
|
||||
dcraw -c -q $2 $3 $4 $5 -H $6 -k ${19} ${21} -g $7 $8 -o ${20} $9 $1 | \
|
||||
convert ${14} - ${15} $(printf "${10}/${11}_%06d.${12}" ${count})
|
||||
convert ${14} - ${15} -set colorspace RGB -set colorspace sRGB $(printf "${10}/${11}_%06d.${12}" ${count})
|
||||
echo -e "\e[2K\rDNG to ${12^^}: Frame ${count^^}/${13}\c"
|
||||
fi
|
||||
}
|
||||
} #-p /home/sofus/subhome/src/convmlv/care-package/linear_rgb.icc
|
||||
|
||||
export -f img_par
|
||||
|
||||
|
@ -1533,7 +1570,7 @@ for ARG in "${FILE_ARGS_ITER[@]}"; do #Go through FILE_ARGS_ITER array, copied f
|
|||
|
||||
#Convert all the actual DNGs to IMG_FMT, in parallel.
|
||||
find "${TMP}" -maxdepth 1 -name '*.dng' -print0 | sort -z | xargs -0 -I {} -P $THREADS -n 1 \
|
||||
bash -c "img_par '{}' '$DEMO_MODE' '$FOUR_COLOR' '$BADPIXELS' '$WHITE' '$HIGHLIGHT_MODE' '$GAMMA' '$NOISE_REDUC' '$DEPTH' \
|
||||
bash -c "img_par '{}' '$DEMO_MODE' '$FOUR_COLOR' '$BADPIXELS' '$WHITE' '$HIGHLIGHT_MODE' '$GAMMA' '$WAVE_NOISE' '$DEPTH' \
|
||||
'$SEQ' '$TRUNC_ARG' '$IMG_FMT' '$FRAME_END' '$DEPTH_OUT' '$COMPRESS' '$isJPG' '$PROXY_SCALE' '$PROXY' '$BLACK_LEVEL' '$SPACE' '$SATPOINT'"
|
||||
|
||||
# Removed | cut -d '' -f $FRAME_RANGE , as this happens when creating the DNGs in the first place.
|
||||
|
@ -1546,25 +1583,49 @@ for ARG in "${FILE_ARGS_ITER[@]}"; do #Go through FILE_ARGS_ITER array, copied f
|
|||
|
||||
echo -e "\n"
|
||||
|
||||
#Apply a LUT to non-EXR images.
|
||||
if [ $isLUT == true ]; then #Some way to package this into the development itself without piping hell?
|
||||
if [ $IMG_FMT == "exr" ]; then
|
||||
echo -e "*Cannot apply LUT to EXR sequences."
|
||||
else
|
||||
echo -e "\e[1m${TRUNC_ARG}:\e[0m Applying LUT to ${FRAMES} ${IMG_FMT^^}s...\n"
|
||||
#FFMPEG Filter Application: Temporal Denoising, 3D LUTs so far. See construction of $V_FILTERS in PREPARATION.
|
||||
if [[ $FFMPEG_FILTERS == true ]]; then
|
||||
tmpFiltered=${TMP}/filtered
|
||||
mkdir $tmpFiltered
|
||||
|
||||
lutLoc="${TMP}/lut_conv"
|
||||
mkdirS $lutLoc
|
||||
|
||||
find $SEQ -name "*.${IMG_FMT}" -print0 | cut -d '' -f $FRAME_RANGE | tr -d "\n" | xargs -0 -I '{}' mv {} "${lutLoc}"
|
||||
ffmpeg -f image2 -i "${lutLoc}/${TRUNC_ARG}_%06d.${IMG_FMT}" -loglevel panic -stats -vf $LUT "${SEQ}/${TRUNC_ARG}_%06d.${IMG_FMT}"
|
||||
#Give correct output.
|
||||
if [[ $isTemp == true && $isLUT == true ]]; then
|
||||
echo -e "\e[1m${TRUNC_ARG}:\e[0m Temporal Denoising and LUT Application...\n"
|
||||
elif [[ $isTemp == false && $isLUT == true ]]; then
|
||||
echo -e "\e[1m${TRUNC_ARG}:\e[0m LUT Application...\n"
|
||||
elif [[ $isTemp == true && $isLUT == false ]]; then
|
||||
echo -e "\e[1m${TRUNC_ARG}:\e[0m Temporal Denoising...\n"
|
||||
fi
|
||||
|
||||
if [ $IMG_FMT == "exr" ]; then
|
||||
echo -e "Note: EXRs may hang after filtering.\n"
|
||||
|
||||
img_res=$(identify ${SEQ}/${TRUNC_ARG}_$(printf "%06d" $(echo "$FRAME_START" | bc)).${IMG_FMT} | cut -d$' ' -f3)
|
||||
|
||||
convert -set colorspace RGB -define stream:buffer-size=0 -set colorspace RGB "${SEQ}/${TRUNC_ARG}_%06d.exr[${FRAME_START}-${FRAME_END}]" ppm:- | \
|
||||
ffmpeg -f image2pipe -vcodec ppm -s "${img_res}" -r $FPS -loglevel panic -stats -i pipe:0 \
|
||||
$V_FILTERS \
|
||||
-vcodec ppm -n -r $FPS -f image2pipe pipe:1 | \
|
||||
convert -depth 16 - -set colorspace RGB -compress piz -set colorspace RGB "${tmpFiltered}/%06d.${IMG_FMT}" #Watch colorspace.
|
||||
else
|
||||
ffmpeg -start_number $FRAME_START -f image2 -i "${SEQ}/${TRUNC_ARG}_%06d.${IMG_FMT}" -loglevel panic -stats $V_FILTERS "${tmpFiltered}/%06d.${IMG_FMT}"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
#Replace the images in $SEQ with the filtered ones.
|
||||
i=$FRAME_START
|
||||
for img in $tmpFiltered/*.${IMG_FMT}; do
|
||||
repl=$(printf "${SEQ}/${TRUNC_ARG}_%06d.${IMG_FMT}" $i)
|
||||
|
||||
mv $img $repl
|
||||
|
||||
((i+=1))
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
#MOVIE PROCESSING
|
||||
VID="${FILE}/${TRUNC_ARG}"
|
||||
SCALE=`echo "($(echo "${PROXY_SCALE}" | sed 's/%//') / 100) * 2" | bc -l` #Get scale as factor for halved video, *2 for 50%
|
||||
|
||||
SOUND="-i ${TMP}/${TRUNC_ARG}_.wav"
|
||||
SOUND_ACTION="-c:a mp3"
|
||||
|
@ -1574,16 +1635,17 @@ for ARG in "${FILE_ARGS_ITER[@]}"; do #Go through FILE_ARGS_ITER array, copied f
|
|||
fi
|
||||
|
||||
if [ $MOVIE == true ] && [ $IMAGES == false ]; then
|
||||
#LUT is automatically applied if argument was passed.
|
||||
if [ $isH264 == true ]; then
|
||||
echo -e "\e[1m${TRUNC_ARG}:\e[0m Encoding to ProRes/H.264..."
|
||||
runSim dcrawOpt mov_main mov_prox
|
||||
else
|
||||
echo -e "\e[1m${TRUNC_ARG}:\e[0m Encoding to ProRes..."
|
||||
dcrawOpt | mov_main
|
||||
exit
|
||||
fi
|
||||
echo ""
|
||||
elif [ $MOVIE == true ] && [ $IMAGES == true ]; then #Use images if available, as opposed to developing the files again.
|
||||
V_FILTERS="" #We don't need this any more for this run - already applied to the images.
|
||||
V_FILTERS_PROX="-vf $FINAL_SCALE"
|
||||
if [ $isH264 == true ]; then
|
||||
echo -e "\e[1m${TRUNC_ARG}:\e[0m Encoding to ProRes/H.264..."
|
||||
runSim dcrawImg mov_main mov_prox
|
||||
|
@ -1591,15 +1653,18 @@ for ARG in "${FILE_ARGS_ITER[@]}"; do #Go through FILE_ARGS_ITER array, copied f
|
|||
echo -e "\e[1m${TRUNC_ARG}:\e[0m Encoding to ProRes..."
|
||||
dcrawImg | mov_main
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ $MOVIE == false ] && [ $isH264 == true ]; then
|
||||
echo -e "\e[1m${TRUNC_ARG}:\e[0m Encoding to H.264..."
|
||||
if [ $IMAGES == true ]; then
|
||||
V_FILTERS_PROX="-vf $FINAL_SCALE" #See above note.
|
||||
dcrawImg | mov_prox
|
||||
else
|
||||
dcrawOpt | mov_prox
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
|
||||
#Potentially move DNGs.
|
||||
|
|
Loading…
Reference in New Issue