-
Notifications
You must be signed in to change notification settings - Fork 47
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
Showing
3 changed files
with
13 additions
and
2 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
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
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 |
---|---|---|
|
@@ -9,6 +9,8 @@ function printHelpAndExit { | |
echo 'Options: (all optional)' | ||
echo ' c CROP: The x and y crops, from the top left of the image, i.e. 640:480' | ||
echo ' o OUTPUT: The basename of the file to be output (default "output")' | ||
echo ' l LOOP: The number of times to loop the animnation. 0 (default)' | ||
echo ' for infinity.' | ||
echo ' r FPS@SPEED: With [email protected], output at 60FPS at a speed of 1.5x the' | ||
echo ' source material. NOTE: It is best to keep FPSxSPEED' | ||
echo ' below approximately 60.' | ||
|
@@ -22,16 +24,18 @@ function printHelpAndExit { | |
|
||
crop= | ||
output= | ||
loop=0 | ||
fpsspeed='10@1' | ||
scale= | ||
|
||
OPTERR=0 | ||
|
||
while getopts 'c:o:p:r:s:' opt; do | ||
while getopts 'c:o:l:p:r:s:' opt; do | ||
case $opt in | ||
c) crop=$OPTARG;; | ||
h) printHelpAndExit 0;; | ||
o) output=$OPTARG;; | ||
l) loop=$OPTARG;; | ||
r) fpsspeed=$OPTARG;; | ||
p) scale=$OPTARG;; | ||
*) printHelpAndExit 1;; | ||
|
@@ -86,5 +90,5 @@ delay=$(bc -l <<< "100/$fps/$speed") | |
temp=$(mktemp /tmp/tempfile.XXXXXXXXX) | ||
|
||
ffmpeg -loglevel panic -i "$filename" $filter -r $fps -f image2pipe -vcodec ppm - >> $temp | ||
cat $temp | convert +dither -layers Optimize -delay $delay - "${output}.gif" | ||
cat $temp | convert +dither -layers Optimize -loop $loop -delay $delay - "${output}.gif" | ||
echo "${output}.gif" |