首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

用yamdi跟ffmpeg把mp4文件转换为flv 并且加上metadata信息

2013-12-19 
用yamdi和ffmpeg把mp4文件转换为flv 并且加上metadata信息#/bin/sh#####################################

用yamdi和ffmpeg把mp4文件转换为flv 并且加上metadata信息
#/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 $1start_stat_time=`date "+%s"`if [ -z $1 ] || [ -z $2 ];then echo "Useage: $0 sourcefile targetfile" exit -1fitest -f $1 || { echo >&2 "The $1 file no exist, please check it."; exit -1; }#check ffmpeg commandcommand -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 $2if [ $? -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." fielse echo "ffmepg exec Failure."fiend_stat_time=`date "+%s"`echo "####recoder end####, this rencode total took time [$((end_stat_time-start_stat_time))] second."

?

热点排行