安装ffmpeg
首先在CentOS环境安装ffmpeg,可以在官网找下载链接,也可以到这里。
cd /usr/local
wget https://johnvansickle.com/ffmpeg/release-source/ffmpeg-4.1.tar.xz
tar xvJf ffmpeg-4.1.tar.xz
cd ffmpeg-4.1
yum install yasm
./configure --enable-shared --prefix=/usr/local/ffmpeg # 检测配置生产makefile
make # 从makefile中读取指令进行编译,约20分钟
make install # 安装
修改conf:
vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/ffmpeg/lib/
运行查看版本:
./ffmpeg -version
配置Path,不在话下:
export PATH=$PATH:/usr/local/ffmpeg/bin
Python代码
首先安装模块:
pip install ffmpy
示例代码:
ff = ffmpy.FFmpeg(inputs={video_path: None}, outputs={thumbnail_path: ['-ss', '00:00:00.000', '-vframes', '1']})
ff.run()











网友评论