如何在CentOS 7上安装和使用FFmpeg

FFmpeg是一个免费和开源的工具集合,用于处理多媒体文件。它包含一组共享的音频和视频库,如libavcodec,libavformat和libavutil。使用FFmpeg,您可以在各种视频和音频格式之间进行转换,设置采样率,捕获流式音频/视频和调整视频大小。

echo "[local]
name=local
baseurl=file:///media
gpgcheck=0
enabled=1" > /etc/yum.repos.d/local.repo

yum install SDL -y
yum install SDL-devel -y

rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/epel//epel-release-latest-7.noarch.rpm
yum install epel-release
yum install ffmpeg ffmpeg-devel

rpm -v --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 localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm

yum install ffmpeg ffmpeg-devel

git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

直接下载 (OK):

wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
xz -d ffmpeg-release-amd64-static.tar.xz
tar xf ffmpeg-release-amd64-static.tar
cd ffmpeg-4.1.2-amd64-static/
ln -s /root/ffmpeg-4.1.2-amd64-static/ffmpeg /bin/ffmpeg

ffmpeg -i "t.mkv" -codec copy "t.mp4"

for i in *.mkv; do
    ffmpeg -i "$i" -codec copy "${i%.*}.mp4"
done

参考文章

点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注