Skip to content

IClip的 async tick(time: number),默认周期是多少?可以自己自定义吗? #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xeoshow opened this issue Mar 28, 2024 · 6 comments

Comments

@xeoshow
Copy link

xeoshow commented Mar 28, 2024

如题
https://hughfenghen.github.io/WebAV/_api/av-cliper/interfaces/IClip.html#tick
779d5a030e99c653f276ef929665e4f

@hughfenghen
Copy link
Collaborator

hughfenghen commented Mar 28, 2024

tickIClip 接口的公开方法

  1. 如果你直接使用 Clip(比如解码素材 渲染),时间周期由调用者自行控制
    • 多次调用 MP4Clip.tick 最好维持一定频率,否则可能会影响性能
  2. 如果你使用 Combinator 合成视频,Combinator 目前固定输出 30FPS 的视频,每次调用 tick 的时间增加 33ms
    • 如果有诉求设置视频的 FPS,可另外提需求
    • 每次增加 33ms 不是间隔,注意区别;程序处理完所有素材的一帧后,会立即增加 33ms 开启下一轮循环调用IClip.tick;因此合成导出一分钟的视频,可能只需要 10s

解码视频 DEMO 源码演示了如何直接调用 tick 方法,注意观察不同播放速度下 tick 参数 time 的增量控制。

Combinator 是如何使用 tick 合成多个 Clip 图像的,需要阅读项目源码。

@xeoshow
Copy link
Author

xeoshow commented Mar 28, 2024

最好可以周期时间更小的颗粒度,因为小颗粒度到粗颗粒度,可以在里面等待一帧就行,但粗颗粒度无法到小颗粒度...
大部分时候还是有60帧率的诉求?

@xeoshow
Copy link
Author

xeoshow commented Mar 29, 2024

或者最好可以外部有某个API,可以初始化设置该周期

@xeoshow
Copy link
Author

xeoshow commented Mar 30, 2024

我们在尝试和我们已有canvas逻辑整合,我们自己canvas代码里也有ticker逻辑,大概如下所示。尝试了好几天,我们ticker和IClip的 async tick(time: number),整合非常非常困难。
是否有可能,IClip的ticker,直接就用我们自己那个ticker进去呢?

app.ticker.add((delta) => {
  // 每次渲染完成时会触发该回调,delta时间值并不恒定,是为了保持对不同性能设备都有良好的顺畅度
  ......
});

@hughfenghen
Copy link
Collaborator

经沟通未能理解上下文

@xeoshow
Copy link
Author

xeoshow commented Apr 15, 2024

这个问题也可以参看这个后续的单开的issue:
#75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants