forked from Hermann-SW/fork-raspiraw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cd88af
commit ce1839a
Showing
3 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <stdio.h> | ||
#include <assert.h> | ||
#include <string.h> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
FILE *src = fopen(argv[1],"rb"); | ||
char line[1999]; | ||
int w,h,f,i; | ||
|
||
assert(src); | ||
fgets(line, 1999, src); assert(0 == strcmp(line, "P6\n")); | ||
fgets(line, 1999, src); assert(2 == sscanf(line, "%d %d", &w, &h)); | ||
fgets(line, 1999, src); assert(1 == sscanf(line, "%d", &f)); | ||
assert(3*w < 1999); | ||
assert(9 <= printf("P6\n%d %d\n%d\n",w,2*h,f)); | ||
|
||
for(i=0; i<h; ++i) | ||
{ | ||
assert(3*w == fread(line, 1, 3*w, src)); | ||
assert(3*w == fwrite(line, 1, 3*w, stdout)); | ||
assert(3*w == fwrite(line, 1, 3*w, stdout)); | ||
} | ||
|
||
h=ftell(src); fseek(src, 0, SEEK_END); assert(h == ftell(src)); | ||
|
||
fclose(src); | ||
return 0; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
# doc: http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html | ||
# needs: ffmpeg | ||
|
||
palette="/tmp/palette.png" | ||
|
||
#filters="fps=15,scale=320:-1:flags=lanczos" | ||
filters="fps=25,scale=640:-1:flags=lanczos" | ||
|
||
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette | ||
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
# needs: dcraw, double, netpbm tools, gstreamer, gifenc.sh | ||
|
||
echo "copying /dev/shm/out.????.raw files" | ||
for((f=100; f<200; ++f)) | ||
do | ||
# cp /dev/shm/out.0$f.raw . | ||
cat hd0.raw /dev/shm/out.0$f.raw > out.0$f.raw | ||
echo -en "$f \r" | ||
done | ||
echo | ||
|
||
echo "dcraw each .raw file (to .ppm)" | ||
for f in *.raw | ||
do | ||
dcraw $f | ||
echo -en "$f \r" | ||
done | ||
echo | ||
|
||
echo ".ppm -> .ppm.d" | ||
for f in *.ppm | ||
do | ||
double $f > $f.d | ||
echo -en "$f \r" | ||
done | ||
echo | ||
|
||
echo ".ppm.d -> .ppm.d.png" | ||
for f in *.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=1 caps="image/png,framerate=\(fraction\)25/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" |