CentOS 下使用 ffmpeg 进行视频格式转换
不想使用 Windows 下的某大师、某工厂或某精灵的话可以试试,这些方法和工具不收费。
CentOS 下安装 ffmpeg
CentOS 7
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm yum install ffmpeg ffmpeg-devel -y
CentOS 6
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm yum install ffmpeg ffmpeg-devel -y
用法
mp3 to ogg
ffmpeg -i v.mp3 -c:a libvorbis -q:a 4 v.ogg
flv to mp4
ffmpeg -i v.flv -y -vcodec copy -acodec copy v.mp4
avi to flv
ffmpeg -i v.avi v.flv
mpg to mp4
ffmpeg -i v.mpg -f mp4 -acodec libfaac -vcodec mpeg4 -b:v 256k -ab 64k v.mp4
vob to mpg
ffmpeg -i v.vob -f mpeg -acodec mp2 -vcodec mpeg1video -s 352x240 -b:v 1152k -ab 128k v.mpg
avi to m4v
ffmpeg -i v.avi -f mp4 -acodec libfaac -vcodec libx264 -b:v 512k -ab 320k v.m4v
从视频里提取声音
ffmpeg -i v.flv -vn a.mp3
去除视频中的声音
ffmpeg -i v.flv -an v_new.flv
常见问题
问题:Please use -b:a or -b:v, -b is ambiguous
解答:视频时把“-b”改为“-b:v”,音频时把“-b”改为“-b:a”
<End>