PHP-FFMpeg 操作视频/音频文件

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

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值