媒体基金会无缝循环问题

发布于 2025-01-25 10:52:23 字数 3023 浏览 4 评论 0原文

我正在尝试在游戏引擎中制作无缝的循环视频,我有两个问题。

  1. 即使我使用了音序器源,我仍然发现两个视频之间的播放并非完全无缝。我收集了一些日志,如下所示。
1   [2022.04.29-12:20:59:557]Session 000001B52BF8EB00:Topology 000001B4FE096960 changed status  Ready   
2   [2022.04.29-12:20:59:564]Processing New Presentation 000001B52BF8EB00   
3   [2022.04.29-12:20:59:564]Session 000001B52BF8EB00:Topology 000001B4FE096960 changed status to Started Source
4   [2022.04.29-12:20:59:629]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 66.667
5   [2022.04.29-12:20:59:662]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 100.00
6   [2022.04.29-12:20:59:696]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 133.333
7   [2022.04.29-12:20:59:729]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 166.667
8   [2022.04.29-12:20:59:771]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 200.00
9   ...
10  [2022.04.29-12:21:00:396]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 833.333 
11  [2022.04.29-12:21:00:429]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 866.667 
12  [2022.04.29-12:21:00:463]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 900.00  
13  [2022.04.29-12:21:00:496]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 933.333
14  [2022.04.29-12:21:00:525]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 966.667 
15  [2022.04.29-12:21:00:548]Session 000001B52BF8EB00:Topology 000001B5650E7480 changed status to Ready 
16  [2022.04.29-12:21:00:548]Session 000001B52BF8EB00:Topology 000001B5650E7480 changed status to Started Source    
17  [2022.04.29-12:21:00:548]Processing New Presentation 000001B52BF8EB00   
18  [2022.04.29-12:21:00:577]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 1000.00 
19  [2022.04.29-12:21:00:602]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 1033.333    
20  [2022.04.29-12:21:00:602]Session 000001B52BF8EB00: Topology 000001B4FE096960 changed status to Ended    
21  [2022.04.29-12:21:00:602]Session 000001B52BF8EB00:Topology 000001B5650E7480 changed status to Sink Switched 
22  [2022.04.29-12:21:00:693]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 1133.333    
23  [2022.04.29-12:21:00:722]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 1166.666    
24  [2022.04.29-12:21:00:768]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 1200.000
25  [2022.04.29-12:21:00:798]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 1233.333    
26  ...

第1-8行是第一个视频段的开始,第10-25行是关于第一个视频段和第二个视频段之间的切换。第21行是拓扑切换事件,我们在第22行中收到了帧数据,这导致了约100毫秒的延迟。音序器源中的所有拓扑都共享相同的Imfactivate对象。该对象是由mfcreatempamplegrabbersinkactivate创建的。我不知道是否应该在拓扑之间共享任何拓扑节点,例如输出节点。因此,我想知道如何杀死100ms的延迟。

  1. 我通过将重复的视频段附加到Sequencer源来实现循环。参考文档,如果应用程序在同一拓扑上多次称为附录学,则输入列表可以具有重复的拓扑。因此,我尝试了两次附加相同的拓扑结构,但是第二个拓扑不能正常播放。我发现在第二次拓扑的启动源活动开始后,我立即收到了最终活动。我试图重复使用媒体来源而不是拓扑,而是用相同的媒体来源构建不同的拓扑,但仍然行不通。最后,我使用一个全新的媒体源对象为同一视频段构建了一个全新的拓扑对象,这对我有用,但这显然非常糟糕。那么,如何按照文档所说的重复使用拓扑对象呢?

谢谢你!

I am trying to make seamless looping video in a game engine, and I have two questions.

  1. Even though I used the Sequencer Source, I still found that the playback between two videos is not exactly seamless. I collected some logs as follows.
1   [2022.04.29-12:20:59:557]Session 000001B52BF8EB00:Topology 000001B4FE096960 changed status  Ready   
2   [2022.04.29-12:20:59:564]Processing New Presentation 000001B52BF8EB00   
3   [2022.04.29-12:20:59:564]Session 000001B52BF8EB00:Topology 000001B4FE096960 changed status to Started Source
4   [2022.04.29-12:20:59:629]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 66.667
5   [2022.04.29-12:20:59:662]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 100.00
6   [2022.04.29-12:20:59:696]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 133.333
7   [2022.04.29-12:20:59:729]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 166.667
8   [2022.04.29-12:20:59:771]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 200.00
9   ...
10  [2022.04.29-12:21:00:396]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 833.333 
11  [2022.04.29-12:21:00:429]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 866.667 
12  [2022.04.29-12:21:00:463]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 900.00  
13  [2022.04.29-12:21:00:496]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 933.333
14  [2022.04.29-12:21:00:525]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 966.667 
15  [2022.04.29-12:21:00:548]Session 000001B52BF8EB00:Topology 000001B5650E7480 changed status to Ready 
16  [2022.04.29-12:21:00:548]Session 000001B52BF8EB00:Topology 000001B5650E7480 changed status to Started Source    
17  [2022.04.29-12:21:00:548]Processing New Presentation 000001B52BF8EB00   
18  [2022.04.29-12:21:00:577]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 1000.00 
19  [2022.04.29-12:21:00:602]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 1033.333    
20  [2022.04.29-12:21:00:602]Session 000001B52BF8EB00: Topology 000001B4FE096960 changed status to Ended    
21  [2022.04.29-12:21:00:602]Session 000001B52BF8EB00:Topology 000001B5650E7480 changed status to Sink Switched 
22  [2022.04.29-12:21:00:693]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 1133.333    
23  [2022.04.29-12:21:00:722]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 1166.666    
24  [2022.04.29-12:21:00:768]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 1200.000
25  [2022.04.29-12:21:00:798]IMFSampleGrabberSinkCallback::OnProcessSample at Timestamp 1233.333    
26  ...

Lines 1-8 is the starting of the first video segment, Line 10-25 is about the switching between the first video segment and the second video segment. Line 21 is the topology switching event, and we received frame data at Line 22, this caused about 100ms delay. All the topologies in the sequencer source share the same IMFActivate object. This object is created by MFCreateSampleGrabberSinkActivate. I don't know if any topology nodes should be shared among the topologies, such as output node. So I want to know how to kill the 100ms delay.

  1. I implemented looping by appending repeated video segment to the sequencer source. Reference to the documentation, the input list can have duplicate topologies if the application called AppendTopology on the same topology more than once. So I tried appending the same topology twice, but the second one cannot be played normally. I found that I received Ended event right after Started Source event of the second topology. I tried to reuse media source instead of topology, building a different topology with same media source, but still not work. Finally, I build a brand new topology object with a brand new media source object for a same video segment, this worked for me but this is obviously very bad. So how can I reuse the topology object as the documentation said?

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文