Here are my different ways of applying white balance. Maybe helpful. Best would be to work out something like MLVS in which dmilligan finds kelvin numbers and rgb numbers and through some algorithms obtained via ufraw he nails wb from cam settings from mlv files.
First it gets wb multipliers from the first dng file in the folder
dcraw -T -a -v -c ${BASE}"$date_02"_000000.dng 2>&1 | awk '/multipliers/ { print $2,$3,$4,$5 }' > /tmp/magic_l_MLV/mltpl_a
Wtemp_2=$(cat /tmp/magic_l_MLV/mltpl_a)
If one or more CR2 are present next to the mlv/raw files it skips the dng multiplier and lists the CR2 according to filmed closest in time to the mlv/raw file. In the listing procedure it will move the CR2 used to an ORIGINALS folder when a group is finished
if ls ../*.CR2
then
dcraw -i -v ../*.CR2 2>&1 | awk '/Camera multipliers/ { print $3,$4,$5,$6 }' > /tmp/magic_l_MLV/wB_03
Wtemp_2=$(cat /tmp/magic_l_MLV/wB_03)
ls -tr ../*.RAW ../*.MLV ../*.CR2 | awk 'NR==2' > /tmp/magic_l_MLV/wB_a_02b
ls -tr ../*.RAW ../*.MLV ../*.CR2 | awk 'NR==1' > /tmp/magic_l_MLV/wB_a_02c
ls ../*.RAW ../*.MLV > /tmp/magic_l_MLV/wB_a_02d
if ! grep 'MLV\|RAW' /tmp/magic_l_MLV/wB_a_02d
then
mv ../*.CR2 ../ORIGINALS
fi
if grep 'CR2' /tmp/magic_l_MLV/wB_a_02b
then
wB_01=$(cat /tmp/magic_l_MLV/wB_a_02c)
mv $wB_01 ../ORIGINALS
fi
fi
The multipliers can be calculated and applied to a dng file as well (asshotneutral value) but it has to involve some basic math. I found out how through a white balance thread from chmee.
The "else" tail is calculating the asshotneutral values through a dng file creating auto white balance through dcraw to the dng files if no CR2 file is present.
if ls ../*.CR2
then
dcraw -i -v ../*.CR2 | awk '/Camera multipliers/ { print $3; exit }' > /tmp/magic_l_MLV/wB_p_01
wB_p_01=$(cat /tmp/magic_l_MLV/wB_p_01)
dcraw -i -v ../*.CR2 | awk '/Camera multipliers/ { print $5; exit }' > /tmp/magic_l_MLV/wB_p_02
wB_p_02=$(cat /tmp/magic_l_MLV/wB_p_02)
echo 1024.000000/$wB_p_01 | bc -l | awk 'FNR == 1 {print}' > /tmp/magic_l_MLV/wB_p_result_01
wB_p_res_01=$(cat /tmp/magic_l_MLV/wB_p_result_01)
echo 1024.000000/$wB_p_02 | bc -l | awk 'FNR == 1 {print}' > /tmp/magic_l_MLV/wB_p_result_02
wB_p_res_02=$(cat /tmp/magic_l_MLV/wB_p_result_02)
echo "-AsShotNeutral=$wB_p_res_01 1 $wB_p_res_02" > /tmp/magic_l_MLV/wB_p_result_03
wip_01=$(cat /tmp/magic_l_MLV/wB_p_result_03)
ls -tr ../*.RAW ../*.MLV ../*.CR2 | awk 'NR==2' > /tmp/magic_l_MLV/wB_a_p
ls -tr ../*.RAW ../*.MLV ../*.CR2 | awk 'NR==1' > /tmp/magic_l_MLV/wB_a_pp
ls ../*.RAW ../*.MLV > /tmp/magic_l_MLV/wB_a_pi
if ! grep 'MLV\|RAW' /tmp/magic_l_MLV/wB_a_pi
then
mv ../*.CR2 ../ORIGINALS
fi
if grep 'CR2' /tmp/magic_l_MLV/wB_a_p
then
wB_p=$(cat /tmp/magic_l_MLV/wB_a_pp)
mv $wB_p ../ORIGINALS
fi
else
dcraw -T -a -v -c ${BASE}"$date_01"_000000.dng 2>&1 | awk '/multipliers/ { print $2 }' > /tmp/magic_l_MLV/a_wb
num_01=$(cat /tmp/magic_l_MLV/a_wb)
dcraw -T -a -v -c ${BASE}"$date_01"_000000.dng 2>&1 | awk '/multipliers/ { print $3 }' > /tmp/magic_l_MLV/a_wb
num_02=$(cat /tmp/magic_l_MLV/a_wb)
dcraw -T -a -v -c ${BASE}"$date_01"_000000.dng 2>&1 | awk '/multipliers/ { print $4 }' > /tmp/magic_l_MLV/a_wb
num_03=$(cat /tmp/magic_l_MLV/a_wb)
dcraw -T -a -v -c ${BASE}"$date_01"_000000.dng 2>&1 | awk '/multipliers/ { print $5 }' > /tmp/magic_l_MLV/a_wb
num_04=$(cat /tmp/magic_l_MLV/a_wb)
echo $num_02/$num_01 | bc -l | awk 'FNR == 1 {print}' > /tmp/magic_l_MLV/wB_p_result_0_a
num_01=$(cat /tmp/magic_l_MLV/wB_p_result_0_a)
echo $num_04/$num_03 | bc -l | awk 'FNR == 1 {print}' > /tmp/magic_l_MLV/wB_p_result_0_b
num_02=$(cat /tmp/magic_l_MLV/wB_p_result_0_b)
echo "-AsShotNeutral=$num_01 1 $num_02" > /tmp/magic_l_MLV/wB_p_result_04
wip_01=$(cat /tmp/magic_l_MLV/wB_p_result_04)
fi