Software introduction

FFmpeg is the leading multimedia framework capable of decoding, encoding, transcoding, mixing, decrypting, streaming, filtering, and playing back almost everything created by humans and machines. It supports the most obscure and ancient formats, right down to the cutting edge. Whether they are designed by a standards committee, a community or a company. It is also highly portable.

FFmpeg can compile, run on Linux, Mac OS X, Microsoft Windows, BSDs, Solaris, and a variety of build environments, machine architectures, and configurations, and pass the test infrastructure FATE.

It contains libavcodec, libavutil, libavFormat, libavFilter, libavDevice, libswScale, and libswresample and can be used by applications. There are also FFMPEG, FFPlay, and FFProbe, which can be used by end users for transcoding and playback.

The installation

First go to the official website

www.ffmpeg.org/download.ht…

Select the Window version in the middle, see there are two, and want to talk about the first keybond.

Select the first link to jump to the download page as shown below:

On the page, select relex-full.7z to download.

Let’s talk about the second link.

Clicking on it will take you to Github. The diagram below:

Select the GPL version of Win64. And then download it

Add system environment variables

C:\ ffmPEG-4.4-full_build \ ffmPEG-4.4-full_build \bin, add the bin directory to the system environment variable.

Enter ffmpeg — version in PowerShell

If the preceding information is displayed, the configuration is successful.

 

Common commands for extracting images

ffmpeg -i 1.mp4 -r 1 image-%3d.jpg
Copy the code

 

  • -i Video files
  • -r 1 indicates the number of exported image frames per second
  • Image -%3d.jpeg Output image, 3D indicates the image number 3 digits, % 03D can fill zero

ffmpeg -i 1.mp4 -r 30 -t 4 image-%3d.jpg
Copy the code
  • -t: indicates the frame of t seconds
ffmpeg -i 1.mp4 -r 30 -ss 00:00:20 image-%3d.jpg
Copy the code

-ss: indicates the initial time of capturing frames

ffmpeg -i test.mp4 -r 30 -ss 00:00:20 -vframes 10 image-%3d.jpg
Copy the code

-vframes: indicates the number of frames to be captured

To generate clearer and uncompressed images:

ffmpeg -i 1.mp4 -f image2 -vf fps=1/5 -qscale:v 2 img%04d.jpg
Copy the code

-i: indicates the video path

-f: Indicates the image format

FPS =1/5: 1 frame per 5s

Img % 04D.jpg: name format of the generated image