#/bin/sh #################################################################### # Mp4 file convert to flv. # $1 source file full-path , e.g.:/a/b/c.mp4 # $2 target file full-path . e.g.:/a/b/c.flv #################################################################### # #check $1 start_stat_time=`date "+%s"` if [ -z $1 ] || [ -z $2 ];then echo "Useage: $0 sourcefile targetfile" exit -1 fi test -f $1 || { echo >&2 "The $1 file no exist, please check it."; exit -1; } #check ffmpeg command command -v ffmpeg >/dev/null 2>&1 || { echo >&2 "I require ffmpeg but it's not installed. Aborting."; exit -1; } ffmpeg -y -i $1 -vcodec copy -acodec copy $2 if [ $? -eq 0 ];then echo "ffmepg exec Success." #add metadata info to flv,用于在视频网站拖放进度 yamdi -i $2 -w -o $2.flv if [ $? -eq 0 ];then echo "yamdi exec Success." else echo "yamdi exec Failure." fi else echo "ffmepg exec Failure." fi end_stat_time=`date "+%s"` echo "####recoder end####, this rencode total took time [$((end_stat_time-start_stat_time))] second."