Skip to content

Commit

Permalink
bitplane tweaks
Browse files Browse the repository at this point in the history
- put Y,U,V print statements back in
- pulled random # selection out of filter function to allow for user specified values
- changed random number range to -1-10
  • Loading branch information
bturkus authored Nov 3, 2020
1 parent f4d57b0 commit 971fd91
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions bash_scripts/bitplane.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ $(basename "${0}")
EOF
}

low=-1
high=10
rand1=$((low + RANDOM%(1+high-low)))
rand2=$((low + RANDOM%(1+high-low)))
rand3=$((low + RANDOM%(1+high-low)))

function filter_complex()
{
Y="${3:-$rand1}" # user selected or, if not, random default value bet 1-8
U="${4:-$rand2}" # user selected or, if not, random default value bet 1-8
V="${5:-$rand3}" # user selected or, if not, random default value bet 1-8

low=1
high=8
rand1=$((low + RANDOM%(1+high-low)))
rand2=$((low + RANDOM%(1+high-low)))
rand3=$((low + RANDOM%(1+high-low)))

Y="${3:-$rand1}" # user selected or, if not, random default value bet 1-8
U="${4:-$rand2}" # user selected or, if not, random default value bet 1-8
V="${5:-$rand3}" # user selected or, if not, random default value bet 1-8
function filter_complex()
{

filter_string="format=yuv420p10le|yuv422p10le|yuv444p10le|yuv440p10le,lutyuv=y=if(eq($Y\,-1)\,512\,if(eq($Y\,0)\,val\,bitand(val\,pow(2\,10-$Y))*pow(2\,$Y))):u=if(eq($U\,-1)\,512\,if(eq($U\,0)\,val\,bitand(val\,pow(2\,10-$U))*pow(2\,$U))):v=if(eq($V\,-1)\,512\,if(eq($V\,0)\,val\,bitand(val\,pow(2\,10-$V))*pow(2\,$V))),format=yuv422p10le"

Expand All @@ -54,15 +54,22 @@ while getopts "hps" OPT ; do
p)
ffplay "${2}" -vf $(filter_complex)
printf "\n\n*******START FFPLAY COMMANDS*******\n" >&2
echo "Y:" $Y
echo "U:" $U
echo "V:" $V
printf "ffplay '$2' -vf '$(filter_complex)'" >&2
printf "\n********END FFPLAY COMMANDS********\n\n " >&2
;;
s)
ffmpeg -hide_banner -i "${2}" -c:v prores -profile:v 3 -vf $(filter_complex) "${2%.*}_bitplane.mov"
ffmpeg -hide_banner -i "${2}" -c:v prores -profile:v 3 -an -vf $(filter_complex) "${2%.*}_bitplane.mov"
printf "\n\n*******START FFMPEG COMMANDS*******\n" >&2
echo "Y:" $Y
echo "U:" $U
echo "V:" $V
printf "ffmpeg -hide_banner -i '$2' -c:v prores -profile:v 3 -filter_complex '$(filter_complex)' '${2%.*}_bitplane.mov'" >&2
printf "\n********END FFMPEG COMMANDS********\n\n " >&2
;;
*) echo "bad option -${OPTARG}" ; _usage ; exit 1 ;
esac
done

0 comments on commit 971fd91

Please sign in to comment.