Comments (5)
不建议使用 CALayer,可以参考这里的说得贴纸部分的使用方式:中文使用文档
from cabbage.
非常感谢vitoziv的回复!但是如果直接使用ImageOverlayItem实现字幕和动画贴图,我有几个问题比较疑惑:
1.如果不使用CALayer怎样支持类似GIF的动效贴图。
2.字幕和动效贴图在编辑时的预览显示,是交由Cabbage直接渲染到视频上,还是根据Timeline自己去控制显示和动画的位置。现在预览是生成CALayer交由AVSynchronizedLayer来处理的。还有就是通过ImageOverlayItem实现每次编辑调整后都需要Build PlayerItem这样可能会导致播放器闪烁一下。
3.我通过加载Image来创建一个TackItem,然后添加到overlays上面也可以实现叠加字幕的效果,不知道这种方式和你示例上通过TimeLine的passingThroughVideoCompositionProvider和ImageOverlayItem添加有什么区别。
from cabbage.
你可以继承 ImageResource,实现一个 GIFResource,在内部根据时间返回 gif 的画面。
编辑的时候,你可以用 AVSynchronizedLayer 来做预览,禁用 Cabbage 的渲染,等到截图和导出的时候使用 Cabbage 渲染。
添加到 overlays 上会有个数限制,在底层其实是添加了视频轨道,所以适合添加视频类型的 TrackItem 到 overlays 上。纯图片贴纸用 passingThroughVideoCompositionProvider,可以减少视频轨道使用。
from cabbage.
好的,非常感谢!
from cabbage.
我的做法很简单,不知道合不合适。
原本我也想使用AVSynchronizedLayer来做预览,发现不太好使,因为添加的字幕和贴图有需求需要拖动改变大小以及旋转等各种操作。所以我在预览的时候做的一个假view,只是添加到playverView上面,方便操作等各种处理,至于显示和隐藏全部是基于当初设置的时间范围做调整,在合成视频的时候把所有的CALayer统一放到AVVideoCompositionCoreAnimationTool上去渲染出来。
from cabbage.
Related Issues (20)
- Player add blur background HOT 6
- Use Kingfisher to report an error
- About the text overlay, edit, drag and drop, zoom. HOT 1
- CIImage Memory leak HOT 2
- Overlay H.265 Video with Transparency HOT 4
- option to change number of frames on export
- Sound gone when scaled video HOT 1
- Multiple timelines HOT 1
- black screen when the audio overlay goes to finish HOT 2
- transition demo not work HOT 1
- 如何知道轨道和片段之间的关系
- Is this framework support multiple layer blend mode? HOT 1
- Capture the current frame in composed player item HOT 1
- avplayer seek后,影音不同步 HOT 1
- Exported video appears to be darker (colour shifting) HOT 3
- Orientation problem: some videos are rotated by 90 or 180 degrees
- Example of merging several videos in sequence
- Example project doesn't work on Xcode 15 HOT 1
- 导出视频需要的时间太长
- how to support animation tools? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cabbage.