Common Commands for ffmpeg
1. Video Related
1.1 Automatic video encoding conversion
1 | |
- -i input.mp4: This flag (
-i) specifies the input file (input.mp4).-iis followed by the name of the input video file that you want to process. In this case,input.mp4is the input video file. - -crf 10: This flag stands for Constant Rate Factor (CRF).
-crfis followed by a numerical value. In this case,10is used as the CRF value. CRF is a parameter used for video encoding inffmpegthat controls the quality and size of the output video. Lower CRF values correspond to higher quality and larger file sizes, while higher CRF values mean lower quality and smaller file sizes. A CRF value of 10 is generally considered high quality with a moderate file size. - output.mp4: This is the output file name. After processing the input file (
input.mp4) using the specified CRF value (10),ffmpegwill create an output file namedoutput.mp4.
2. Audio Related
2.1 Extracting the audio from a video file
1 | |
- -i input.mp4 This flag (
-i) specifies the input file (input.mp4).-iis followed by the name of the input file that you want to process. In this case,input.mp4is the input video file. - -q:a 0: This flag sets the audio quality for the output file.
-q:astands for “audio quality.” The value0indicates the highest possible quality for the audio. Using0for audio quality often means there’s little to no perceptible loss in audio quality due to compression. - -map a: This flag tells
ffmpegto select a specific stream from the input file.-mapis used to choose a particular stream within the input file. In this case,arefers to the audio stream of the input file. - output.mp3: This is the output file name. After processing the input file (specified as
meeting_17.mp4),ffmpegwill create an output file namedoutput.mp3. The.mp3extension indicates that the output file will be an MP3 audio file.
2.2 Extracting a specific segment of the audio
1 | |
- -i output.mp3: This flag (
-i) specifies the input file (output.mp3).-iis followed by the name of the input audio file that you want to process. In this case,output.mp3is the input audio file. - -ss 1:18:09: This flag stands for “start time.”
-ssis used to indicate the starting point from where the audio will be processed.1:18:09denotes the timestamp in the format ofhours:minutes:seconds(1 hour, 18 minutes, and 9 seconds). It means the processing will begin from this specific time point in the input audio file (output.mp3). - -to 2:18:09: This flag stands for “end time.”
-tois used to indicate the endpoint for the processing.2:18:09denotes the timestamp in the format ofhours:minutes:seconds(2 hours, 18 minutes, and 9 seconds). It means the processing will end at this specific time point in the input audio file (output.mp3). - 1hours.mp3: This is the output file name. After processing the input file (specified as
output.mp3) from the starting time (1:18:09) to the end time (2:18:09),ffmpegwill create an output file named1hours.mp3.
Common Commands for ffmpeg
https://www.hardyhu.cn/2023/10/23/Common-Commands-for-ffmpeg/