forked from Hermann-SW/fork-raspiraw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
raw2ogg2anim
executable file
·58 lines (48 loc) · 1.23 KB
/
raw2ogg2anim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# needs: dcraw, double, netpbm tools, gstreamer, gifenc.sh
if [ "$4" = "" ]; then echo "format: `basename $0` vname first last fps [d[d]]"; exit; fi
echo "removing old auxiliary files"
rm -f out.*.raw out.*.ppm out.*.ppm.[dDT] out.*.ppm.d.png
echo "copying /dev/shm/out.????.raw files"
for((f=$2; f<=$3; ++f))
do
# cp /dev/shm/out.$(printf "%04d" $f).raw .
cat hd0.32k /dev/shm/out.$(printf "%04d" $f).raw >out.$(printf "%04d" $f).raw
echo -en "$f \r"
done
echo
echo "dcraw each .raw file (to .ppm)"
for f in out.*.raw
do
dcraw $f
echo -en "$f \r"
done
echo
echo ".ppm -> .ppm.d"
for f in out.*.ppm
do
if [ "$5" = "" ]; then
ln -s $f $f.d
else
if [ "$5" = "d" ]; then
double $f > $f.d
else
double $f > $f.D
double $f.D > $f.d
fi
fi
echo -en "$f \r"
done
echo
echo ".ppm.d -> .ppm.d.png"
for f in out.*.ppm.d
do
pnmtopng $f > $f.png
echo -en "$f \r"
done
echo
echo "now creating $1.ogg"
gst-launch-1.0 multifilesrc location="out.%04d.ppm.d.png" index=$2 caps="image/png,framerate=\(fraction\)$4/1" ! pngdec ! videorate ! videoconvert ! videorate ! theoraenc ! oggmux ! filesink location="$1.ogg"
echo "now creating $1.anim.gif"
gifenc.sh $1.ogg $1.anim.gif
echo "done"