Getting Started with ffmpeg (1): Composition and Introduction

composition

ffmpeg is a complete cross-platform solution for recording, converting and streaming audio and video. FFmpeg is developed under the Linux platform, but it can also be compiled and run in other operating system environments, including Windows, Mac OS X, etc. This project was originally initiated by Fabrice Bellard and is now maintained by Michael Niedermayer. Many FFmpeg developers come from the MPlayer project, and currently FFmpeg is also placed on the server of the MPlayer project team. The name of the project comes from the MPEG Video Coding Standard, where the preceding "FF" stands for "Fast Forward".

Related terms are explained below:

 

the term full name illustrate
ffmpeg Fast forword mpeg Audio Video Converter
ffplay Fast forword play A player implemented with ffmpeg
ffserver Fast forword server rstp server implemented with ffmpeg
ffprobe fast forward probe Used to enter the analysis input stream

 

The main function library is as follows:

libavutil: A function library that simplifies programming, such as generating random numbers, data structures, teaching cases, core multimedia programs, etc.

libavcodec: used to encode and decode audio and video.

libavformat: Used for multiplexing and demultiplexing of multimedia format packages. (Multiplexing and demultiplexing are technical terms, which will be introduced later)

libavdevice: Used to read and write data for input/output device data, including Video4Linux, Video4Linux2, VfW, and ALSA.

libavfilter: used to call multimedia filters.

libswscale: is a library of highly optimized image scaling and color space/pixel format conversion operations.

libswresample: is a highly optimized library for audio resampling and rearranging color matrix operations.

Invoke command rules:

ffmpeg [global_options] {[input_file_options] -i input_file} ... {[output_file_options] output_file} ...

Parameter options consist of three parts: (1) An optional set of global parameters. (2) One or more sets of input file parameters. (3) One or more sets of output file parameters.

Among them, each set of input file parameters ends with '-i'; each set of output file parameters ends with the output file name, square brackets indicate optional items, and curly braces indicate mandatory items.

Introduction

ffmpeg is a converter that can convert video and audio at high speed, and it can also capture real-time video and audio. ffmpeg can use high-quality polyphase filters to convert video at any bitrate.

ffmpeg can read any number of input files (such as standardized files, pipes, network data streams, data capture devices, etc.), and call it through -i; similarly, it can  write any number of output files, and the output files are composed of a pure output As specified by the file name, any command item that cannot be recognized by the system will be considered as an output file when writing the output file parameter.

Each input and input file, in principle, can contain multiple different types of data streams (video/audio/subtitle/attachment/data), and these different types of data streams will be determined according to the format of the file encapsulation. Which data stream is selected in the input file as the data stream of the output file is also automated. If you want to know, you can refer to the section about Stream in the ffmpeg official website document.

When using the index of the input file to point to the command item, the index value starts counting from 0, such as 2:3 refers to the fourth data stream of the third input file.

As a general rule, each command of a command item points to the next file by default, so you can use the same command item multiple times to point to the next file, but there are exceptions, such as the global command item should be written first.

When writing the command line, do not confuse the input file and the output file. The input file is written in the front, and the output file is written in the back. Both the input file and the output file have their own command items.

Example command line call:

(1) Modify the bit rate of a video to 64kbit/s

ffmpeg -i input.avi -b:v 64k -bufsize 64k output.avi

(2) Modify the frame rate of a video

ffmpeg -i input.avi -r 24 output.avi

(3) Forcibly modify the frame rate of the input file to 1, and generate an output file with a frame rate of 24 at the same time

ffmpeg -r 1 -i input.m2v -r 24 output.avi

 

Guess you like

Origin blog.csdn.net/zeping891103/article/details/51578402