问题描述
强制关键帧是什么意思?
What does forcing key frames mean?
根据文档
仍然无法理解在指定的时间戳上强制关键帧是什么意思,它的用途是什么?我可以看到在分割视频时使用了此命令.它的目的是什么?
Still I am not able to understand what does forcing key frames at specified timestamp means and what is its use?I can see this command is used while segmenting video.What is its purpose there?
推荐答案
典型的视频编解码器使用时间压缩,即大多数帧仅存储相对于较早(在某些情况下为将来)帧的差异.因此,为了解码这些帧,必须参考较早的帧,以便生成完整图像.简而言之,关键帧是不依赖其他帧进行解码的帧,和是其他帧依赖以进行解码的帧.
A typical video codec uses temporal compression i.e. most frames only store the difference with respect to earlier (and in some cases, future) frames. So, in order to decode these frames, earlier frames have to be referenced, in order to generate a full image. In short, keyframes are frames which don't rely on other frames for decoding, and which other frames rely on in order to get decoded.
如果必须对视频进行剪切或分段,而无需进行转码(重新压缩),则分段只能在关键帧处进行,因此片段的第一帧就是关键帧.如果不是这种情况,则直到下一个关键帧为止的一段帧都无法播放.
If a video has to be cut or segmented, without transcoding (recompression), then the segmenting can only occur at keyframes, so that the first frame of a segment is a keyframe. If this were not the case, then the frames of a segment till the next keyframe could not be played.
像x264这样的编码器通常仅在检测到场景发生变化时才生成关键帧*.这不利于细分,因为关键帧可能会以不规则的间隔生成.为了确保可以制作相同且可预测的长度段,可以使用force_key_frames选项来确保所需的关键帧放置.
A encoder like x264 typically generates keyframes only if it detects that a scene change has occurred*. This isn't conducive for segmentation, as the keyframes may be generated at irregular intervals. In order to ensure that segments of identical and predictable lengths can be made, the force_key_frames option can be used to ensure desired keyframe placement.
-force_key_frames expr:gte(t,n_forced * 5)
强制关键帧在t = 5,10,15秒...
-force_key_frames expr:gte(t,n_forced*5)
forces a keyframe at t=5,10,15 seconds...
GOP大小选项 g
是另一种确保关键帧放置的方法,例如 -g 50
每50帧强制设置一个关键帧.
The GOP size option g
is another method to ensure keyframe placement, e.g. -g 50
forces a keyframe every 50 frames.
*取决于最小和最大关键帧距离参数.
*subject to minimum and maximum keyframe distance parameters.
这篇关于强制关键帧是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!