FFmpeg+SDL---Use of FFmpeg command line tool

Chapter Two Use of FFmpeg Command Line Tool

It is recommended to read before reading this chapter: FFmpeg+SDL-----Syllabus

table of Contents

• Background
• Command line basics
• FFmpeg command line tool acquisition
• ffmpeg.exe use: transcoding
• ffplay.exe use: playback
• practice

background

1. Widely used

  • Video players that use FFmpeg as the core: Mplayer, Archer Player, Baofeng Yingyin, KMPlayer, QQ Yingyin...
  • Use FFmpeg as the core transcoder: format factory, raccoon video converter, storm transcoding...
  • All in all, FFmpeg is the "Swiss Army Knife" in the video industry
    2. Features
  • Based on the command line: The Fmpeg interface is not very user-friendly, and the operation is relatively complicated, but it is also more flexible.
  • Open source: It can attract outstanding developers from all over the world to join in the development.

Command line basics

1. What is the command line? It is
similar to the command window of the DOS operating system. The opposite of "command line" is "graphical interface.
2. Why use command line.
Advantages: flexible and convenient for batch processing.
Disadvantages: unfriendly interface.
3. To open,
click "Start→Programs→Accessories→Command Prompt" or running Enter "CMD" in the window.
4. Basic DOS commands

  • The most critical command
    • Open the specified folder command cd {file path}
    • Switch to the upper level folder cd…
    • Change the current drive letter command c:
  • Other commands
    • View the contents of the directory command dir
    • Create directory command md
    • File copy command copy
    • Delete file command del
    • Clear screen command cls
  • Additional commands provided by Windows system
    • Such as ping, ipconfig, etc.

Obtaining FFmpeg command line tool

1. Download address
Visit FFmpeg official website ( http://ffmpeg.org ) → select Download → select Windows Package → enter Zeranoe FFmpeg station. (Be careful not to download the source code directly from the FFmpeg official website.)
2. Version Description
The FFmpeg on the Zeranoe website is divided into 3 versions:
(1) Static: Only contains 3 large exe.
(2) Shared: In addition to 3 smaller exe, it also contains dll dynamic library files.
(3) Dev: Only includes the header file ( .h) and import library file ( .lib) for development.
PS: Just download the Static or Shared version when using the command line.
3. Simple to use
Unzip the downloaded compressed package to any directory (such as D:\ffmpeg), open the command line tool, switch to the bin folder of ffmpeg, and enter ffmpeg.exe in the command line to view the pop-up information.

Use of ffmpeg.exe

Command format

1. The function
ffmpeg.exe is used for video transcoding.
2. The simplest command

ffmpeg -i input.avi -b:v 640k output.ts 		//该命令将当前文件夹下的input.avi文件转换为output.ts文件,并将output.ts文件视频的码率设置为640kbps。
ffmpeg.exe -ss 15 -i  cuc_ieschool.mkv -s 1280*720 -r 7 -t 5 cuc_ieschool.mp4		//设置从15秒开始截取5s,设置帧率为7,帧尺寸为1280*720

3. Command format
ffmpeg -i {input file path} -b:v {output video bitrate} {output file path}
All parameters are specified in the form of key-value pairs. For example, the input file parameter is "-i", and the parameter value is the file path; the output video bit rate parameter is "-b:v", and the parameter value is the video bit rate value. But note that the last output file path does not contain the parameter name

Command parameters

Insert picture description here
PS: For detailed parameters, please visit http://ffmpeg.org/ffmpeg.html

Use of ffplay.exe

Command format

1. The function
ffplay.exe is used for video playback.
2. The simplest command

ffplay input.avi 		//该命令将播放当前文件夹下的input.avi文件。

3. Command format

ffplay {输入文件路径} 

The parameter format of ffplay.exe is similar to ffmpeg.exe. All parameters are specified in the form of key-value pairs (because the output file is not included, only input parameters can be specified). Note that the parameter name is not included in front of the input file path at the end.

hot key

Insert picture description here
PS: For detailed parameters, please visit http://ffmpeg.org/ffplay.html

Guess you like

Origin blog.csdn.net/weixin_37921201/article/details/89367480
Recommended