如何显示/显示捕获的时间? [英] How to show/display captured time ?

查看:118
本文介绍了如何显示/显示捕获的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用Directshow和Decklink Studio 2开发视频捕获应用程序,并使用Main Concept MPEG-2编码器将捕获的视频保存在Mpeg-2中.我的应用程序如下所示:

Decklink视频捕获-> MC MPEG-2视频编码器-> .....

................................................... ................................... MC MPEG MUXER->文件编写器(.mpg)

Decklink音频捕获-> MC MPEG-2音频编码器-> .....

一切正常,但是我想实时显示捕获持续时间,如何获取捕获时的持续时间?

有人可以帮我提供示例或示例代码的方法吗?

预先谢谢您.

Hi,
I am developing a video capture application using Directshow with Decklink Studio 2 and saving the captured video in Mpeg-2 using Main Concept MPEG-2 Encoder.My application looks like this:

Decklink Video Capture -> MC MPEG-2 Video Encoder ->.....

............................................................................ MC MPEG MUXER -> File Writer(.mpg)

Decklink Audio Capture -> MC MPEG-2 Audio Encoder ->.....

Everything works fine, but I want to display capture duration in real time.How can I get duration while capture?

Can anyone help me with example or sample code how to do that?

Thank you in advance.

推荐答案

创建DS转换过滤器,并拦截媒体时间/实时时间

Create a DS transform filter, and intercept the media time/real time

The third one should be helpful[^]


您可以为此创建一个工作线程.在开始编码之前,创建并启动线程.编码完成后,停止线程(建议使用事件).

在线程内部,获取入口点的开始时间.然后在停止事件上使用带有WaitForSingleObject()的循环,并且超时值为1000 ms.超时后,计算当前时间与开始时间之间的时差,然后使用窗口句柄和用户定义的消息号(WM_APP + x)通过PostMessage()将该值发送到应用程序的主窗口或进度对话框窗口或WM_USER + x).

这不是真正的实时时间,但是对于显示经过的时间应该足够了.
You may create a worker thread for this. Just before starting the encoding, create and start the thread. When the encoding has finished, stop the thread (using an event is recommended).

Inside the thread get the start time at the entry point. Then use a loop with WaitForSingleObject() on your stop event and a time out value of 1000 ms. Upon timeout, calculate the difference between current time and start time, and send that value via PostMessage() to your application''s main window or a progress dialog window using the windows handle and a user defined message number (WM_APP+x or WM_USER+x).

This is not really real time, but should be sufficient for the display of elapsed time.


这篇关于如何显示/显示捕获的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆