FFMpeg官方文档:https://ffmpeg.org/ffmpeg.html
第一步:安装下载 :http://www.ffmpeg.org/download.html
然后配置环境变量,打开cmd,输入ffmpeg --version,输入 ffmpeg,显示信息代表安装成功。
常用语句:
1.音频转视频命令:
命令:ffmpeg.exe -i D:\WWW\wx_small_doctor_cases\php\public\test.mp3 D:\WWW\wx_small_doctor_cases\php\public\study.mp4
2.多图片+音频合并
先将图片写入txt文件
file '../../group_essence_files/images/images/1563873349.6067154.jpg' duration 5 file '../../group_essence_files/images/images/1563873349.6067154.jpg' duration 5
注意:duration是帧数,图片播放的时间(秒),图片的路径要根据txt文件所在的的路径去找,../ 代表上一级目录
命令:ffmpeg.exe -threads 2 -y -f concat -safe 0 -i D:\WWW\wx_small_doctor_cases\php\public/uploadfile/imageTxt/group_1/img_20190830_1_6979.txt -s 1920x1080 -pix_fmt yuvj420p -vcodec libx264 D:\WWW\wx_small_doctor_cases\php\public/uploadfile/video/single/group_1/v2_20190830_9427.mp4
3.音频合并
命令:-i "concat:D:\WWW\wx_small_doctor_cases\php\public/1.mp3|D:\WWW\wx_small_doctor_cases\php\public/2.mp3|D:\WWW\wx_small_doctor_cases\php\public/3.mp3" -acodec copy D:\WWW\wx_small_doctor_cases\php\public/all.mp4
4.视频合并
命令:ffmpeg.exe -f concat -safe 0 -i D:\WWW\wx_small_doctor_cases\php\public/1.mp4 -c copy D:\WWW\wx_small_doctor_cases\php\public/test.mp4