Last active
November 30, 2015 07:00
-
-
Save barrbrain/a03033188c849651f998 to your computer and use it in GitHub Desktop.
Script to render a video of quantization effects in daala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
readlinkf(){ perl -MCwd -e 'print Cwd::abs_path shift' "$1";} | |
DAALA_ROOT="$(readlinkf ${DAALA_ROOT:-.})" | |
INPUT_IMAGE="$(readlinkf $1)" | |
OUTPUT_VIDEO="$(readlinkf ${2:-$(basename "$INPUT_IMAGE").webm})" | |
cq="0 1 2 3 4 5 7 9 11 13 16 19 22 25 28 33 38 44 50 57 64 73 82 92 104 117 132 148 166 187 209 235 263 295 330 369 413 462" | |
P=${P:-4} | |
( | |
cd /tmp | |
FIFOS="`echo -n $cq|sed 's/[0-9][0-9]*/&.y4m/g'`" | |
rm -f $FIFOS | |
mkfifo $FIFOS | |
( cat `echo $FIFOS | cut -f1 -d' '`; tail -n +2 -q `echo $FIFOS | cut -f2- -d' '`; rm $FIFOS ) & | |
( for v in $cq | |
do | |
( | |
DIR=`mktemp -d /tmp/daala.XXXXXX` | |
cd "$DIR" | |
ln /tmp/"$v".y4m 00000000out-.y4m | |
"$DAALA_ROOT"/examples/encoder_example -v$v "$INPUT_IMAGE" 2>/dev/null >/dev/null | |
rm 00000000out-.y4m | |
cd .. | |
rmdir "$DIR" | |
) & | |
[[ `jobs|wc -l` -lt $P ]] || wait | |
done | |
wait | |
) | |
wait | |
) | | |
ffmpeg -f yuv4mpegpipe -r 6 -i pipe: -pix_fmt yuv420p -vcodec libvpx-vp9 -lossless 1 -speed 0 -tile-columns 0 -frame-parallel 0 -f webm -y "$OUTPUT_VIDEO" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment