SetCodec
Top  Previous  Next

Description

Sets the name of the codec (video compressor) to be used during the AVI capture.


Syntax


[VB]
objActiveGeni.SetCodec Name [, Quality, Datarate, Keyframe ])


[C/C++]
HRESULT SetCodec(bstr Name [, long Quality = 0, long Datarate = 0, long Keyframe = 0 ]);


Data Types
[VB]

Name: String
Quality
: Integer
Datarate: Integer
Keyframe: Integer

Parameters
[C/C++]

Name [in]  
String specifying the name of the feature  
Quality [out, retval]  
Numerical value of the quality parameter used by the codec, if supported.  
Datarate [out, retval]  
Datarate in kb/sec used by the codec, if supported.  
Keyframe [out, retval]  
The amount of frames after which a key frame is recorded, if supported.  


Return Values


S_OK  
Success  
E_FAIL  
Failure to set the codec  
 

Example


The following VB example demonstrates the use of the DivX codec:

Private Sub
Form_Load()
ActiveGeni1.SetCodec "DivX 5.0.2 Codec"
ActiveGeni1.Acquire=
True

End Sub


Private Sub
StartButton_Click()
ActiveGeni1.StartCapture "c:\mycapture.avi"

End Sub


Private Sub
StopButton_Click()
ActiveGeni1.StopCapture

End Sub


The following VB example demonstrates how to set up a codec by its index in the system:

CodecList=ActiveGeni1.GetCodecList
CodecName=CodecList(9)
ActiveGeni1.SetCodec CodecName
 

Remarks


This method allows you to set only the basic compression parameters which may not be supported by certain codecs. To adjust the internal parameters of a codec, use ShowCodecDialog.

The name of the codec must be precise in order for SetCodec to work. An extra space in the name of the codec may cause this function to fail. To avoid errors, It is recommended to use an index of the codec rather than its name, as shown in the second example above.

ActiveGeni video recording engine includes a proprietary "Raw Uncompressed" codec. When the camera streams video in the Bayer format and the "Raw Uncompressed codec is selected, ActiveGeni records the video in its original raw format while displaying it in color. This reduces the disk space requirements by three times without any degradation in the image quality. In addition, when high-depth pixel formats are used (such as Bayer10, Bayer12, Bayer16, Mono10, Mono 12, Mono16), the recorded video will be packed into the 12-bit per pixel format as opposed to 16 bit, thus saving extra 25% of the disk space. To decode and play back AVI files recorded with the "Raw Uncompressed" codec, use video playback methods of the DVR version of ActiveGeni.