FFmpeg installation and download (linux and windows)

1、Windows

Log in to the official website of FFmepg: http://ffmpeg.org/download.html
Insert picture description here
Insert picture description here

wget https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2020-11-05-12-30/ffmpeg-N-99863-g70d8077b79-win64-gpl-shared-vulkan.zip

Download and unzip it to a local file, and then add it to the environment variable
C:\FFmpeg\ffmpeg-N-99863-g70d8077b79-win64-gpl-shared-vulkan\bin to
open the cmd window and enter ffmepg to open it.

2、Linux

(1) Download the installation package

Log in to the official website of FFmepg: http://ffmpeg.org/download.html to
Insert picture description here
view the linux kernel:

cat /proc/version

Insert picture description here
3.10.0 meets the version requirements and can be installed.
Insert picture description here
Enter the installation instructions document: https://www.johnvansickle.com/ffmpeg/faq/
which can be downloaded by the following command

wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz
wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz.md5

(2) Installation

Unzip the file

tar xvf ffmpeg-git-amd64-static.tar.xz

You will get the folder ffmpeg-git-20201104-amd64-static

cd ffmpeg-git-20201104-amd64-static

View the contents of the folder

ls

Insert picture description here
Currently you can already run in the current directory, and you can also run through the absolute path

./ffmpeg

Insert picture description here

(3) Environmental configuration

View your environment variables

echo $PATH

Check if there is an old version of ffmpeg

whereis ffmpeg 

If it exists, you need to delete it first. If it does not exist, you need to do the following directly

sudo cp ffmpeg-git-20201104-amd64-static/ffmpeg ffmpeg-git-20201104-amd64-static/ffprobe /usr/local/bin/

Check the location of ffmpeg and ffprobe

whereis ffmpeg
whereis ffprobe

Insert picture description here
Enter ffmpeg directly on the command line to run

3. Mirror production

You can refer to my other article docker image creation, import and export to build ffmepg docker image, here is my docker image tar package, after decompression, you can use it directly.
Link: https://pan.baidu.com/s/1oNSH5yfxNZ0Uq3vd2f2gDA
Extraction code: qpbo

4. Test code

## 格式转换
ffmpeg -i test.mp4 test.avi
## 图片截取
ffmpeg -i test.avi -r 1 -q:v 2 -f image2 image/image-%05d.jpg
## 视频截取
ffmpeg  -i test.mp4 -vcodec copy -acodec copy -ss 00:00:02 -to 00:00:10 cutout1.mp4
## 视频合并
ffmpeg -f concat -i list.txt -c copy concat.mp4
## 添加文字水印
ffmpeg -i test.mp4 -vf "drawtext=fontfile=arial: text='Flowpp':x=100:y=500:fontsize=24:fontcolor=yellow:shadowy=2" drawtext.mp4
## 添加图片水印
ffmpeg -i test.mp4 -vf "movie=waterMark.jpg[watermark];[in][watermark] overlay=10:10[out]" drawjpg.mp4

Guess you like

Origin blog.csdn.net/weixin_44704985/article/details/109532224