Skip to content

Commit

Permalink
OGV format module. Supports transcoding into PNG and AVI (MPEG4).
Browse files Browse the repository at this point in the history
  • Loading branch information
morevnaproject committed Jul 20, 2013
1 parent a3e6598 commit 118247a
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions modules/mod_ogv
@@ -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"

0 comments on commit 118247a

Please sign in to comment.