官方说明
-t duration (input/output)
说明 -t 时长(输入可以是文件或者录屏或者设备(例如麦克风,摄像头))(输出可以是文件)
When used as an input option (before -i), limit the duration of data read from the input file.
当作为一个输入参数使用的时候(位于-i之前),限制读取输入文件中数据的时长,例如只读取输入文件五分钟的视频数据
When used as an output option (before an output url), stop writing the output after its duration reaches duration.
当作为一个输出参数使用的时候(位于输出URL之前),读取到足够时长的数据,就会停止写入输出文件
duration must be a time duration specification, see (ffmpeg-utils)the Time duration section in the ffmpeg-utils(1) manual.
时长参数必须符合时间时长规范。
-to and -t are mutually exclusive and -t has priority.
-to和-t不能同时使用,并且-t优先使用
使用例子:
ffmpeg -f gdigrab -i desktop -vcodec libx264 -pix_fmt yuv420p -t 60 output.mp4
说明:录屏60秒,然后停止
`-t duration'
Restrict the transcoded/captured video sequence to the duration specified in seconds. hh:mm:ss[.xxx] syntax is also supported.
2.3 Time duration
There are two accepted syntaxes for expressing time duration.
[-][HH:]MM:SS[.m...]
HH expresses the number of hours, MM the number of minutes for a maximum of 2 digits, and SS the number of seconds for a maximum of 2 digits. The m at the end expresses decimal value for SS.
or
[-]S+[.m...][s|ms|us]
S expresses the number of seconds, with the optional decimal part m. The optional literal suffixes ‘s’, ‘ms’ or ‘us’ indicate to interpret the value as seconds, milliseconds or microseconds, respectively.
In both expressions, the optional ‘-’ indicates negative duration.
2.3.1 Examples
The following examples are all valid time duration:
‘55’
55 seconds
‘0.2’
0.2 seconds
‘200ms’
200 milliseconds, that’s 0.2s
‘200000us’
200000 microseconds, that’s 0.2s
‘12:03:45’
12 hours, 03 minutes and 45 seconds
‘23.189’
23.189 seconds