我在上次购买的一个转换视频的php脚本中看到了这段代码。该脚本在Ubuntu 12.04 上运行
-i $file_source -b 9600k -aspect 16:9 -acodec aac -strict experimental -ab 128k -ar 22050 $file_dest"
这就是元素/属性的全部含义,还有什么可供选择?
感谢您的帮助
您可以使用以下命令使用ffmpeg 转换视频
所需编解码器:
- libmp3lame-acodec
- libfaac-acodec
- libvorbis-acodec
- libx264-vcodec
- libtheora-vcodec
- libvpx-vcodec
- FFMPEG构建版本-FFMPEG版本N-54207-ge59fb3f
命令如下-
-
转换为flv-
$file_source = "/tmp/test.mp4"; $file_dest = "/tmp/test.flv"; ffmpeg -i $file_source -pass 1 -vcodec libx264 -preset slower -b 512k -bt 512k -threads 0 -s 640x360 -aspect 16:9 -acodec libmp3lame -ar 44100 -ab 32 -f flv -y $file_dest
-
转换为mp4以支持HTML5-
$file_source = "/tmp/test.flv"; $file_dest = "/tmp/test.mp4"; ffmpeg -y -i $file_source -vcodec libx264 -q:v 1 -preset slower -profile:v baseline -level 30 -crf 30 -vf scale="480:360" -aspect 16:9 -s 640x360 -acodec libfaac -ab 128k -ac 2 -coder ac -me_range 16 -subq 5 -sc_threshold 40 -partitions +parti4x4+partp8x8+partb8x8 -i_qfactor 0.71 -keyint_min 25 -b_strategy 1 -g 250 -r 20 -f mp4 $file_dest
-
转换为webm以支持HTML5-
$file_source = "/tmp/test.mp4"; $file_dest = "/tmp/test.webm"; ffmpeg -y -i $file_source -vcodec libvpx -b:v 480k -bt 480k -preset slower -level 30 -crf 30 -vf scale="480:360" -aspect 16:9 -s 640x360 -acodec libvorbis -ab 128k -ac 2 -coder ac -me_range 16 -subq 5 -sc_threshold 40 -partitions +parti4x4+partp8x8+partb8x8 -i_qfactor 0.71 -keyint_min 25 -b_strategy 1 -g 250 -r 20 -f webm $file_dest
-
转换为ogv以支持HTML5-
$file_source = "/tmp/test.mp4"; $file_dest = "/tmp/test.ogv"; ffmpeg -y -i $file_source -vcodec libtheora -b:v 480k -bt 480k -preset slower -level 30 -crf 30 -vf scale="480:360" -aspect 16:9 -s 640x360 -acodec libvorbis -ab 128k -ac 2 -coder ac -me_range 16 -subq 5 -sc_threshold 40 -partitions +parti4x4+partp8x8+partb8x8 -i_qfactor 0.71 -keyint_min 25 -b_strategy 1 -g 250 -r 20 -f ogg $file_dest;
有关ogg、mp4、网络检查链接html5视频的更多信息,您需要了解的内容和easyhtml5视频
这是FFMPEG的命令行指令
您可以在以下位置阅读替代选项的文档:FFMPEG文档
无论如何,只是为了解释
-i $file_source -b 9600k -aspect 16:9 -acodec aac -strict experimental -ab 128k -ar 22050 $file_dest
其中-i $file_source
是您的输入文件(任何媒体类型)
-b 9600k
是视频比特率
-aspect 16:9
是宽屏
-acodec aac -strict experimental
正在使用AAC编解码器(这是一种实验性编解码器,因此无论如何都要使用strict强制使用)
-ab 128k
是音频比特率128kb/s
-ar 22050
是22.05 khz的音频采样率
$file_dest
输出文件名(带扩展名,以便FFMPEG知道您喜欢的输出格式