Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 13-Jul-12 0:25am
v7

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

The third one should be helpful[^]
 
Share this answer
 
v2
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900