VideoCompressors
property, read-only
property VideoCompressors: string read GetVideoCompressors;
__property System::UnicodeString VideoCompressors = {read=GetVideoCompressors};
public string VideoCompressors { get; }
Public ReadOnly Property VideoCompressors As String
wchar_t *GetVideoCompressors ();
Retrieves a string that contains the list of the video compressors available on the current platform. This list can be assigned to list-based controls. E.g.:
ComboBox1.Items.Text := VideoGrabber1.VideoCompressors;
It is possible to retrieve programmatically the index of a video compressor by using the FindIndexInListByName function as follows:
VideoGrabber.VideoCompressor := VideoGrabber.FindIndexInListByName (VideoGrabber.VideoCompressors, 'name of my video encoder', false, true);
The Media Foundation video encoders of the platform (Windows software encoders, NVIDIA / Intel / AMD GPU encoders), e.g. "H264 GPU (Nvidia)", "H264 CPU (Microsoft)", "H264 (Auto)" (best encoder of the codec, GPU first), are listed after the Datastead Multipurpose Encoder (index 0) and before the DirectShow compressors.
An encoder or a DirectShow compressor that appears after the first build of the list (e.g. RefreshDevicesAndCompressorsLists after the installation of a driver or a codec) is appended at the end of the list. Select the compressors by name (FindIndexInListByName) rather than by a fixed index.
The Media Foundation encoders are used through the Datastead MFT Encoder of TVideoGrabber, without registration: AVI and the other multiplexers, and MP4 (RecordingMethod = rm_MP4: H.264 compressed by the encoder and written as is). VideoCompression_KeyFrameRate / VideoCompression_Quality apply to them when set to other values than their defaults; the Encoder_SetInt / Encoder_SetStr settings do not (FFmpeg codecs of the Datastead Multipurpose Encoder only).
The settings of a Media Foundation video encoder entry can be edited with ShowDialog (dlg_VideoCompressor): rate control (VBR, CBR, constant quality), bit rate, peak bit rate, quality, key frame interval, profile, low latency mode, CPU encoder when the GPU encoder cannot be used. They are saved for that entry, as the settings of the DirectShow compressors (registry; SaveCompressorSettingsToDataString / LoadCompressorSettingsFromDataString), and used from the next recording. VideoCompression_KeyFrameRate / _Quality / _DataRate take precedence when set to other values than their defaults (applied when recording).
MJPEG: the "MJPEG CPU (Microsoft)" entry encodes each frame as a JPEG image with the JPEG encoder of Windows (Windows Imaging Component), several frames at once on multi-core CPUs; every frame is a key frame (e.g. AVI recording, RecordingMethod = rm_AVI). Its quality is set with VideoCompression_Quality (0.01 to 0.99: 1.0, the default value of the property, is not applied) or with ShowDialog (dlg_VideoCompressor), 85 by default. Windows provides no MJPEG encoder for the GPU: a "MJPEG GPU (vendor)" entry appears only if a GPU driver installs one. With RecordingMethod = rm_MP4 it is not used: the video is encoded in H.264 (warning).
The "Datastead Multipurpose Encoder" entry (index 0) is always listed. When the Datastead Multipurpose Encoder is installed, this entry wraps the FFmpeg codecs (H.264, HEVC, AV1, VP9, MPEG-4, ProRes...), configured by Encoder_SetInt / Encoder_SetStr or ShowDialog (dlg_VideoCompressor), see using the Datastead Encoder. When it is not installed, a recording that selects it (CompressionMode = cm_CompressOnTheFly, CompressionType = ct_Video or ct_AudioVideo; not ASF, WebM, MPEG or MOV) uses the natively supported "H264 (Auto)" entry instead, with the warning "Datastead Multipurpose Encoder selected as video compressor but not installed, using instead H264 (Auto)" (OnLog).
To avoid this warning, choose one of the other video compressors listed, e.g.: VideoGrabber.VideoCompressor = VideoGrabber.VideoCompressorIndex ("H264 GPU (Nvidia)");
Note: when the application starts, the VideoCompressors and AudioCompressors lists are populated with the codecs currently installed. To refresh the compressor lists after installing/uninstalling codecs without exiting/restarting the application, invoke RefreshDevicesAndCompressorsLists.