Click here to Skip to main content
15,851,242 members
Articles / Desktop Programming / MFC
Article

Trick: How to Capture Video Screen Shots

Rate me:
Please Sign up or sign in to vote.
3.39/5 (16 votes)
25 Feb 20042 min read 271.4K   6.1K   67   42
An article describing a trick to capture video screen shots.

Video Screen Shot

Introduction

This article describes a "trick" on how to capture video screen shots, irrespective of the source (file, Webcast stream, TV-input).

Background

My task is to capture a screen shot of a video being played. It is easy to capture a screen shot of a window. However with a video being played (e.g. with Media Player), you will capture the window border and a blank video surface. I am sure there is a way to do it with DirectX and DirectShow methods, however I could not find an article on it. If anyone knows the method or a link to an article on this topic, please let me know. HyperSnap-DX from Hyperionics seems to be the only one with the "proper" way of capturing a video screen shot.

Using the code

The demo application is started, CHogVideo will attempt open and pause the video hog.dat. This is to hog the video resources (*the trick*). You can then open your Media Player (or other video players) to play the video you wish to capture. Once the video is playing, start the capture under "Options".

There are no codes specific to this article. However here are a few links to related articles:

Points of Interest

Why it works?

My guess is that the hogging video, being the first video being played, gets priority to the hardware. Subsequent videos played have to use software rendering, which enables Windows GDI to capture a copy of the frame being played.

Do I need the CHogVideo class?

No. CHogVideo is just for demonstration. You could have just started playing a video file and paused it (say with Media Player). Open a second Media Player to play the intended video screen to capture.

When it will work?

The trick will work for if the video resource is hogged first. It will work for video players that utilize DirectX approach for playing the video (this includes Windows Media Player) regardless of the source (from file, Webcast stream, TV-input).

What about Full Screen mode?

Yes, it will also capture videos in full screen mode.

History

  • February 16, 2004 - First version.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Malaysia Malaysia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralRe: Full Screen Capture is not working Pin
jeykumars14-Jun-06 1:00
jeykumars14-Jun-06 1:00 
GeneralRe: Full Screen Capture is not working Pin
Chiew Heng Wah14-Jun-06 16:52
Chiew Heng Wah14-Jun-06 16:52 
GeneralGood But ... Pin
despirados16-Apr-06 15:46
despirados16-Apr-06 15:46 
GeneralCapturing Image of Minimized Window Pin
IslamianFalcon30-Nov-05 2:31
IslamianFalcon30-Nov-05 2:31 
GeneralRe: Capturing Image of Minimized Window Pin
Chiew Heng Wah1-Dec-05 16:11
Chiew Heng Wah1-Dec-05 16:11 
Questioncan dirctshow change the framerate ? Pin
Infinity_man11-May-05 0:21
Infinity_man11-May-05 0:21 
Generalcapturing from mpeg file Pin
Member 153571613-Feb-05 22:12
Member 153571613-Feb-05 22:12 
GeneralRe: capturing from mpeg file Pin
Chiew Heng Wah14-Feb-05 15:18
Chiew Heng Wah14-Feb-05 15:18 
Hi. In such a case you would want a media converter instead. Do a quick search on Googlefor 'mpeg to avi' or try Download.com

Also Microsoft Media Player has an SDK with code samples on doing such a task programatically.
Generalhiiiiii a litle helpp Pin
Mario_Young20-Jan-05 19:11
Mario_Young20-Jan-05 19:11 
GeneralRe: hiiiiii a litle helpp Pin
Chiew Heng Wah23-Jan-05 16:05
Chiew Heng Wah23-Jan-05 16:05 
GeneralCapturing Desktop Pin
m_idris11-Jun-04 1:40
m_idris11-Jun-04 1:40 
GeneralRe: Capturing Desktop Pin
Chiew Heng Wah12-Oct-04 1:49
Chiew Heng Wah12-Oct-04 1:49 
GeneralGuidance Pin
Chivalrous13-Apr-04 20:20
Chivalrous13-Apr-04 20:20 
GeneralRe: Guidance Pin
Chiew Heng Wah14-Apr-04 16:43
Chiew Heng Wah14-Apr-04 16:43 
GeneralRe: Guidance Pin
FlyingTinman3-May-04 17:00
FlyingTinman3-May-04 17:00 
GeneralRe: Guidance Pin
Goldshtein Haim20-Apr-07 12:45
Goldshtein Haim20-Apr-07 12:45 
GeneralDirectShow Capturing Pin
descartes27-Feb-04 0:25
descartes27-Feb-04 0:25 
GeneralRe: DirectShow Capturing Pin
Chiew Heng Wah27-Feb-04 16:13
Chiew Heng Wah27-Feb-04 16:13 
GeneralRe: DirectShow Capturing Pin
descartes28-Feb-04 0:28
descartes28-Feb-04 0:28 
GeneralRe: DirectShow Capturing Pin
Chiew Heng Wah29-Feb-04 15:09
Chiew Heng Wah29-Feb-04 15:09 
GeneralRe: DirectShow Capturing Pin
nowlex29-Mar-04 14:34
nowlex29-Mar-04 14:34 
GeneralRe: DirectShow Capturing Pin
Member 16179991-Jan-05 11:29
Member 16179991-Jan-05 11:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.