Keyframes FFMPEG

huangapple go评论80阅读模式
英文:

Keyframes FFMPEG

问题

有没有一条FFMPEG命令,如果我们传递一个视频文件,它应该在每个场景变化时为其生成一个关键帧。关键帧在我理解中是一个视频的一系列文件(图像或视频文件),可以在鼠标悬停在视频上时用于播放。请告诉我是否可以做到这一点?

英文:

Is there a FFMPEG command, where if we pass a video file, on every scene changes it should produce a keyframe for it. And Keyframe to my understanding is a series of files(image or video) files for an video, which can be used for playing on hover of the video. Kindly let know if we can do this?

答案1

得分: 2

> 是否有一个FFMPEG命令,如果我们传入一个视频文件,它应该在每次场景更改时为其生成一个关键帧。

这取决于使用的编解码器以及您所称之为场景的内容。x264有一个参数用于调整场景敏感度,名为"scenecut"。然而,x264所称之为场景的东西可能与您所称之为场景的东西不同。

例如,迈克尔·贝(Michael Bay)的电影每隔4到5秒钟就会有一个硬切。x264可能会认为每个"切"都是一个场景。任何比切或淡入淡出更复杂的情况,FFMPEG都无法处理。

> 而据我理解,关键帧是视频的一系列文件(图片或视频文件),可以在悬停在视频上时使用,用于播放。如果可以的话,请告诉我我们能做到这一点吗?

不,完全不是这样的。

关键帧是单个帧,不是一系列帧或文件。它也与"悬停"无关。关键帧只是一帧独立的图像帧,这意味着您可以独立解码它,而无需首先解码它可能引用的任何其他帧。

视频压缩不仅仅对每一帧进行编码。它会对一帧进行编码,然后对于下一帧,只编码发生变化的部分。这称为"预测帧",如果不解码所引用的帧,则无法解码它。关键帧只是不引用任何其他帧的帧。

有时,一些播放器可能会进行优化,在悬停时预览关键帧,因为关键帧比预测帧更快解码。但这完全是播放器的优化,不是所有播放器都这样做。

对我来说,这听起来像是一个xyproblem

英文:

> Is there a FFMPEG command, where if we pass a video file, on every
> scene changes it should produce a keyframe for it.

Well, It depends on what codec, and what you are calling a scene. x264 has the scenecut parameter for adjusting scene sensitivity. However, what x264 calls a scene, may not be the same thing you call a scene.

A Michael bay movies for example has a hard cut every 4 or 5 seconds. x264 may consider every "cut" a scene. Anything more clever than a cut, or a fade, ffmpeg will not handle.

> And Keyframe to my understanding is a series of files(image or video)
> files for an video, which can be used for playing on hover of the
> video. Kindly let know if we can do this?

No, not at all.

A key frame is a single frame, not a series of frames or files. It also has nothing to do with "hover". A keyframe is just an independent frame, meaning you can decode it independently without first having to decode any frames that it may reference.

Video compression does not just encode every frame. It will encode a frame, then for the next frame, encode only the parts that changed. This is called a "predicted frame" and it is not decodable without decoding the referenced frame. A key frame is just a frame that does not reference any other frames.

Sometimes some players may make optimizations where it will preview keyframes on hover because keyframes are faster to decode than predicted frames. But this is 100% a player optimization and not all plays do it.

To me, thed sounds line an xyproblem.

huangapple
  • 本文由 发表于 2020年6月6日 01:08:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/62220661.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定