diff --git a/gif-maker/Dockerfile b/gif-maker/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..fc06c5f2eefa1c6476e4bd536da16bd932965805 --- /dev/null +++ b/gif-maker/Dockerfile @@ -0,0 +1,10 @@ +FROM alpine:3.6 + +RUN apk --no-cache add ffmpeg gifsicle curl \ + && curl -LS https://github.com/alexellis/faas/releases/download/0.5.6-alpha/fwatchdog > /usr/bin/fwatchdog \ + && chmod +x /usr/bin/fwatchdog \ + && apk del curl +WORKDIR /root/ +COPY entry.sh . +ENV fprocess="./entry.sh" +CMD ["fwatchdog"] diff --git a/gif-maker/README.md b/gif-maker/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ec6470f815b9fd8622e729f1c7288ab810bd2f61 --- /dev/null +++ b/gif-maker/README.md @@ -0,0 +1,19 @@ +gif-maker +========= + +Converts a .mov QuickTime video to a .gif + +Testing: + +``` +$ docker build -t alexellis/gif-maker . +$ faas-cli deploy --fprocess="./entry.sh" \ + --image get-giffy --name gif-maker + +# wait a little + +$ curl http://localhost:8080/function/gif-maker --data-binary @$HOME/Desktop/screen1.mov > screen1.gif +``` + +Try to use a small cropped video around 5MB. Timeouts may need to be extended for larger videos + diff --git a/gif-maker/entry.sh b/gif-maker/entry.sh new file mode 100755 index 0000000000000000000000000000000000000000..68dc2e5ab25921f0aa4035354eddd38eac788054 --- /dev/null +++ b/gif-maker/entry.sh @@ -0,0 +1,7 @@ +#!/bin/sh +export nano=`date +%s%N` +# -s 600x400 +cat - > ./$nano.mov +ffmpeg -loglevel panic -i $nano.mov -vf scale=iw*.5:ih*.5 -pix_fmt rgb24 -r 20 -f gif - | gifsicle --optimize=3 --delay=3 > /dev/stdout \ + && rm $nano.mov +