ICaptureGraphBuilder2::CopyCaptureFile method (strmif.h)

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The CopyCaptureFile method copies the valid media data from a capture file.

Syntax

HRESULT CopyCaptureFile(
  [in] LPOLESTR                   lpwstrOld,
  [in] LPOLESTR                   lpwstrNew,
  [in] int                        fAllowEscAbort,
  [in] IAMCopyCaptureFileProgress *pCallback
);

Parameters

[in] lpwstrOld

Pointer to a wide-character string that contains the source file name.

[in] lpwstrNew

Pointer to a wide-character string that contains the destination file name. Valid data is copied to this file.

[in] fAllowEscAbort

Boolean value that specifies whether pressing the ESC key cancels the copy operation. If the value is TRUE and the user presses the ESC key, the operation halts. If the value is FALSE, the method ignores the ESC key.

[in] pCallback

Pointer to an IAMCopyCaptureFileProgress interface to display progress information, or NULL. See Remarks for more information.

Return value

Returns an HRESULT value. Possible values include the following.

Return code Description
S_FALSE
User canceled the operation before it completed.
S_OK
Success.
E_FAIL
Failure.
E_INVALIDARG
Could not open the source file or destination file.
E_OUTOFMEMORY
Insufficient memory.
E_POINTER
NULL pointer argument.

Remarks

Typically, you will first capture to a large preallocated file. This method copies just the valid data to a new file. As a result, the new file can be much smaller than the original file.

The source and destination files must be AVI files. Other file types are not supported.

To display the progress of the copy operation, implement the IAMCopyCaptureFileProgress interface and pass a pointer to the interface in the pCallback parameter. If pCallback is non-NULL, this method periodically calls the IAMCopyCaptureFileProgress::Progress method with an integer between 0 and 100 that specifies the percentage complete.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header strmif.h (include Dshow.h)
Library Strmiids.lib

See also

Error and Success Codes

ICaptureGraphBuilder2 Interface