Skip to content

Instantly share code, notes, and snippets.

@AleksandrT
Last active December 23, 2015 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AleksandrT/6636644 to your computer and use it in GitHub Desktop.
Save AleksandrT/6636644 to your computer and use it in GitHub Desktop.
re-encoder.sh
SOURCE="/.../video/flv/1"
DESTINATION="/.../video/wiki/1"
if [[ ! -d $SOURCE ]]; then
echo "$SOURCE doest exist"
exit
fi
if [[ ! -d $DESTINATION ]]; then
echo "'$DESTIANTION' doest exists!"
exit
fi
cd "$SOURCE"
NUM_FILES=`ls | wc -l`
COUNT=0
read -p "Are you sure you want to re-encode $NUM_FILES from '$SOURCE' to '$DESTINATION'? [y/N] " PROMPT
if [[ "$PROMPT" != "y" ]]; then
echo "Aborting."
exit
fi
for i in *.flv; do
((COUNT++))
echo -e "\033[0;31mEncoding $COUNT of $NUM_FILES.\033[0m"
if [[ $COUNT==2 ]]; then
exit
fi
#-vhook '/usr/lib/vhook/imlib2.so -c white -F FreeSans.ttf/12 -x 0 -y 0 -t http://www.spreadthesign.com/'
/usr/bin/ffmpeg -y -i {$i}.flv -an -s 320x240 -vcodec libtheora -q 8 $DESTINATION/${i%.*}.ogv
done
echo -e "\033[0;32mRe-encoding of $NUM_FILES files complete!\033[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment