下载ffmpeg
ffmpeg官网
官网长下面这个样子:

点击左边的Download,并进入到下面的界面。


下一步见图。

下一步见图。

下载完成后得到一个压缩包,如图。

解压到当前文件夹,如图。

通常将其改名为ffmpeg,如图。

文件夹里面是这个样子的,如图。

我们需要的是bin里面的ffmpeg.exe

音频、视频转换
mp4转mp3
ffmpeg -i a.mp4 -f MP3 a.mp3
flv转mp4
ffmpeg -i "xxx.flv" -c copy "xxx.mp4"
合并多个mp4视频
使用ffmpeg合并多个MP4视频的方式有多种,主要分为以下两类:
一、将MP4格式的视频转为其他格式,合并起来之后再转回MP4
1、将mp4转成mpeg(也是一种视频格式)文件,然后利用ffmpeg命令合并起来,然后再转为mp4格式
ffmpeg -i test.mp4 -qscale 4 1.mpg
ffmpeg -i test2.mp4 -qscale 4 2.mpg
ffmpeg -i "concat:1.mpg|2.mpg" -c copy output.mpg
ffmpeg -i output.mpg -y -qscale 0 -vcodec libx264 output.mp4
2、将mp4转为ts文件合并后转为mp4
ffmpeg -i test.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts 1.ts
ffmpeg -i test2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts 2.ts
ffmpeg -i "concat:1.ts|2.ts" -c copy -bsf:a aac_adtstoasc -movflags +faststart ts.mp4
二、是直接将多个MP4直接拼接成一个MP4
1、将合并的文件夹都放在同一个文件夹下,例如:test.mp4,test2.mp4
2、新建一个video.txt文件,文件的内容是需要合并的视频名称,内容格式为
file 'test.mp4'
file 'test2.mp4'
3、执行ffmpeg的命令
ffmpeg -f concat -i video.txt -c copy concat.mp4
执行完之后就可以看到合并起来的视频concat.mp4了。
测试完合并的的文件大小为:直接拼接文件大小 < 转为ts拼接文件大小 < 转为mpeg后拼接文件大小
图片格式转换
webp转换成jpg
ffmpeg -i in.webp out.jpg
webp转换成png
ffmpeg -i in.webp out.png
jpg转换成png
ffmpeg -i in.jpg out.png
jpg转换成webp
ffmpeg -i in.jpg out.webp
png转换成webp
ffmpeg -i in.png out.webp
png转换成jpg
ffmpeg -i in.png out.jpg
感谢
看了这个视频学会的。