Trick: How to Capture Video Screen Shots

Introduction

This article describes a "trick" on how to capture video screen shots, regardless 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 the 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 then can 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 does it work?

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.


Downloads

Comments

  • Trick for capturing video

    Posted by ummarbhutta on 02/25/2009 10:45am

    Here is the trick to get the snap shot of video being played.. Go to Grpahics Properties >> Settings >> Advanced >> Troubleshoot and disable the hardware acceleration.. you will get the video in your snap.. not a black hole..

    Reply
  • capturing from an IP camera

    Posted by mechi on 03/18/2007 09:08am

    How would I go about using an IP camera (with a fixed address) as a SourceFilter for a DirectX application?

    Reply
  • why it does work!

    Posted by ryus on 03/31/2005 02:07pm

    Hi! DirectShow always trays to use the overlay when it is present. so because most graphics cards have only one overlay, if you launch a second video, DirectShow (wich almost all windows video players are built upon) will simply use blitting to the primary surface. In VLC, one can switch to non overlay playback and even to software witch is not the case with media player. another feature of VLC is its debug window... very instructive!

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: May 6, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT While you likely have very good reasons for remaining on WinXP after end of support -- an estimated 20-30% of worldwide devices still are -- the bottom line is your security risk is now significant. In the absence of security patches, attackers will certainly turn their attention to this new opportunity. Join Lumension Vice President Paul Zimski in this one-hour webcast to discuss risk and, more importantly, 5 pragmatic risk mitigation techniques …

  • You probably have several goals for your patient portal of choice. Is "community" one of them? With a bevy of vendors offering portal solutions, it can be challenging for a hospital to know where to start. Fortunately, YourCareCommunity helps ease the decision-making process. Read this white paper to learn more. "3 Ways Clinicians can Leverage a Patient Portal to Craft a Healthcare Community" is a published document owned by www.medhost.com

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds