#!/bin/sh #$Id: avi2flv.sh,v 1.4 2006/11/26 14:44:53 ang23 Exp $ #first arg: filename to convert (avi,vob,mpg,etc.), extension will be replaced with flv #second arg: startposition in seconds (integer) #third arg: preview image time position, format (00:00:00) (HH:MM:SS) #main program if [ "$#" == "0" ]; then exit 0 fi if [ ! -f $1 ]; then echo "argument 1 should be a movie file" exit 0 fi OUT="./" INPUT=`basename ${1}` LOG="${INPUT}-`date +%Y%m%d`-encoding.log" INPUTDIR=`dirname ${1}` if [ -e $2 ]; then STARTPOS=0 else STARTPOS=${2} fi if [ -e $3 ]; then GRABTIME=00:00:01 else GRABTIME=${3} fi echo "Encoding HQ video..." time mencoder \ ${INPUTDIR}/${INPUT} \ -ss ${STARTPOS} \ -af volnorm=1 \ -ofps 20 \ -o ${OUT}${INPUT%.*}-hq.flv \ -of lavf \ -oac mp3lame \ -lameopts abr:br=64 \ -srate 22050 \ -ovc lavc \ -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames \ -lavcopts vcodec=flv:keyint=50:vbitrate=256:mbd=2:mv0:trell:\ v4mv:cbp:last_pred=3 -vop scale=320:240 > $LOG 2>&1 echo "Adding flv metadata to HQ video..." time flvtool2 -U ${OUT}${INPUT%.*}-hq.flv >> $LOG 2>&1 echo "Creating PNG preview... at ${GRABTIME} position" time ffmpeg -y -i ${INPUTDIR}/${INPUT} \ -vframes 1 -ss ${GRABTIME} -an -vcodec png \ -f rawvideo -s 160x120 \ ${OUT}${INPUT%.*}-hq_1_grab-thumb.png >> $LOG 2>&1
use flowplayer wikiplugin in wiki-type tikiwiki object to put video online:
{FLOWPLAYER(videofile=URLtoFLV)}{FLOWPLAYER}