Created
May 15, 2013 03:36
-
-
Save happypeter/5581495 to your computer and use it in GitHub Desktop.
compress videos and transcode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://ruby-china.org/topics/10987 | |
# ffmpeg_compress.sh | |
# $1是源文件,$2是码率,网络传输建议码率是1024k~2048k,$3是分辨率,720p是-1:720,-1表示根据高720保持比例缩放,$4是视频比例,看源视频了,比如4:3, 3:2, 16:9等,$5是输出文件名 | |
# 1st pass: | |
ffmpeg -i $1 -vcodec libx264 -vprofile high -preset slow -b:v $2 -maxrate $2 -bufsize 4000k -vf scale=$3 -aspect $4 -threads 0 -pass 1 -an -f mp4 /dev/null | |
# 2nd pass: | |
ffmpeg -i $1 -vcodec libx264 -vprofile high -preset slow -b:v $2 -maxrate $2 -bufsize 4000k -vf scale=$3 -aspect $4 -threads 0 -pass 2 -acodec libfaac -b:a $5 -f mp4 $6 | |
# 具体使用方法实例: | |
# sh ffmpeg_compress.sh input.avi 2000k -1:720 16:9 output.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment