Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OGV format module. Supports transcoding into PNG and AVI (MPEG4).
- Loading branch information
1 parent
a3e6598
commit 118247a
Showing
1 changed file
with
56 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,56 @@ | ||
#!/bin/bash | ||
|
||
# ==== Utility functions ==== | ||
|
||
escape() | ||
{ | ||
echo "$1"| sed -e "s/ /\\\\\\ /g" | ||
} | ||
|
||
# ==== Module functions ==== | ||
|
||
check(){ | ||
if ! ( which ffmpeg > /dev/null 2>&1 ); then | ||
cat <<EOF | ||
FATAL: Can't find 'ffmpeg' binary! | ||
Please install 'ffmpeg' package using software manager | ||
of your linux distributive. | ||
EOF | ||
exit 1 | ||
fi | ||
} | ||
|
||
format(){ | ||
echo $FORMAT | ||
} | ||
|
||
deps(){ | ||
echo | ||
} | ||
|
||
rules(){ | ||
if [[ $FORMAT == 'avi' ]]; then | ||
OUTPUT="$RENDERPATH" | ||
echo "`escape "$RENDERPATH"`: `escape "$TARGET"` $DEPS" >> "$MAKEFILE" | ||
echo " rm -rf \"$RENDERPATH\"" >> "$MAKEFILE" | ||
#TODO: FPS detection? | ||
echo " ffmpeg -i \"$TARGET\" -qscale 3 -acodec libmp3lame -aq 4 \"$OUTPUT\"" >> "$MAKEFILE" | ||
else | ||
OUTPUT="$RENDERPATH/file.%06d.$FORMAT" | ||
echo "`escape "$RENDERPATH"`: `escape "$RENDERPATH"`/file.lst" >> "$MAKEFILE" | ||
echo " touch \"$RENDERPATH\"" >> "$MAKEFILE" | ||
echo "`escape "$RENDERPATH"`/file.lst: `escape "$TARGET"` $DEPS" >> "$MAKEFILE" | ||
echo " rm -rf \"$RENDERPATH\"" >> "$MAKEFILE" | ||
echo " mkdir -p \"$RENDERPATH\"" >> "$MAKEFILE" | ||
echo " ffmpeg -i \"$TARGET\" -an -f image2 \"$OUTPUT\"" >> "$MAKEFILE" | ||
#TODO: FPS detection? | ||
echo " echo \"FPS $FPS\" > \"$RENDERPATH/file.lst\"" >> "$MAKEFILE" | ||
echo " ( cd \"$RENDERPATH\"; ls -1 *.$FORMAT >> file.lst )" >> "$MAKEFILE" | ||
fi | ||
|
||
echo "`escape "$RENDERPATH"`-clean:" >> "$MAKEFILE" | ||
echo " rm -rf \"$RENDERPATH\"" >> "$MAKEFILE" | ||
} | ||
|
||
$1 "$2" |