Ubuntu下FFmpeg命令中-r参数的用法及官方说明咨询
-r参数的用法详解(针对你的Ubuntu命令) Hey there! Let's break down exactly what the -r parameter does in your FFmpeg command, plus its official specifications:
先看你的命令里的-r 60
In your command:
ffmpeg -i input_video -vf scale=w=320:h=-1 -y -vcodec libx264 -preset ultrafast -r 60 output_video
The -r 60 here acts as an output option (since it's placed before the output file name). It forces the output video to have a frame rate of 60 frames per second (fps).
If your input video has a different frame rate, FFmpeg will automatically adjust: it'll duplicate frames if the output fps is higher than the input, or drop frames if it's lower.
-r参数的两种核心用法
1. Output option (most common for your use case)
When placed before the output file, -r fps sets the exact frame rate of the output video. You can use numerical values (like 60), fractions (e.g., 30000/1001 for NTSC 29.97fps), or even abbreviations where supported.
2. Input option
If you place -r fps before the -i input_video part, it changes how FFmpeg interprets the input's timing:
- It ignores any existing timestamps stored in the input file
- Instead, it generates new timestamps assuming the input has a constant frame rate of
fps
This is different from the -framerate option, which is typically used for input sources that don't have built-in frame rate info (like image sequences).
官方文档原文引用
-r[:stream_specifier] fps (input/output,per-stream)设置帧率(Hz值、分数或缩写形式)。作为输入选项时,忽略文件中存储的任何时间戳,转而假设恒定帧率fps生成时间戳,这与部分输入场景中使用的-framerate选项不同……
内容的提问来源于stack exchange,提问作者machinery

