Giter Club home page Giter Club logo

Comments (5)

vitoziv avatar vitoziv commented on May 22, 2024

不建议使用 CALayer,可以参考这里的说得贴纸部分的使用方式:中文使用文档

from cabbage.

rayn0r126 avatar rayn0r126 commented on May 22, 2024

非常感谢vitoziv的回复!但是如果直接使用ImageOverlayItem实现字幕和动画贴图,我有几个问题比较疑惑:

1.如果不使用CALayer怎样支持类似GIF的动效贴图。

2.字幕和动效贴图在编辑时的预览显示,是交由Cabbage直接渲染到视频上,还是根据Timeline自己去控制显示和动画的位置。现在预览是生成CALayer交由AVSynchronizedLayer来处理的。还有就是通过ImageOverlayItem实现每次编辑调整后都需要Build PlayerItem这样可能会导致播放器闪烁一下。

3.我通过加载Image来创建一个TackItem,然后添加到overlays上面也可以实现叠加字幕的效果,不知道这种方式和你示例上通过TimeLine的passingThroughVideoCompositionProvider和ImageOverlayItem添加有什么区别。

from cabbage.

vitoziv avatar vitoziv commented on May 22, 2024

你可以继承 ImageResource,实现一个 GIFResource,在内部根据时间返回 gif 的画面。
编辑的时候,你可以用 AVSynchronizedLayer 来做预览,禁用 Cabbage 的渲染,等到截图和导出的时候使用 Cabbage 渲染。
添加到 overlays 上会有个数限制,在底层其实是添加了视频轨道,所以适合添加视频类型的 TrackItem 到 overlays 上。纯图片贴纸用 passingThroughVideoCompositionProvider,可以减少视频轨道使用。

from cabbage.

rayn0r126 avatar rayn0r126 commented on May 22, 2024

好的,非常感谢!

from cabbage.

JackMayx avatar JackMayx commented on May 22, 2024

我的做法很简单,不知道合不合适。
原本我也想使用AVSynchronizedLayer来做预览,发现不太好使,因为添加的字幕和贴图有需求需要拖动改变大小以及旋转等各种操作。所以我在预览的时候做的一个假view,只是添加到playverView上面,方便操作等各种处理,至于显示和隐藏全部是基于当初设置的时间范围做调整,在合成视频的时候把所有的CALayer统一放到AVVideoCompositionCoreAnimationTool上去渲染出来。

from cabbage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.