Skip to content

Video window

Note

References to the overlay renderer are deprecated.

Video renderer

The video renderer is selected through the VideoRenderer property:

  • vr_AutoSelect: selected automatically.
  • vr_VMR9: Video Mixing Renderer 9 (VMR9), good quality, more CPU.
  • vr_VMR7: Video Mixing Renderer 7 (VMR7), good quality, less CPU.
  • vr_EVR: enhanced video renderer (EVR), best quality, more CPU.
  • vr_StandardRenderer: standard renderer, average quality, less CPU.
  • vr_OverlayRenderer: overlay renderer, good quality, low CPU.
  • vr_RecordingPriority: recommended if the quality of the recording is more important than the quality of the preview.
  • vr_None: no renderer.
  • vr_madVR: deprecated.
  • vr_DatasteadRealtimeRenderer: low latency, real-time renderer; requires the Datastead RTSP/RTMP/HTTP/ONVIF Source filter to be installed.
  • vr_DatasteadVideoRenderer: Datastead video renderer; requires the Datastead RTSP/RTMP/HTTP/ONVIF Source filter to be installed.

Keeping the last video frame visible while opening the next video clip

By default, after invoking StopPreview, StopRecording or ClosePlayer, the video window is closed until the next clip is opened.

Enable the VideoVisibleWhenStopped property to keep the video window active and the last frame displayed until StartPreview, StartRecording or OpenPlayer starts displaying video frames.

Show / hide the video window

Display_Active specifies whether the video window must be constructed when StartPreview, StartRecording or OpenPlayer is invoked.

While the preview, recording or playback is running, the video window can then be shown or hidden by enabling or disabling Display_Visible.

Size of the video window and auto resizing

The control is automatically resized by TVideoGrabber when Display_AutoSize is enabled; otherwise its size depends on the Width and Height properties.

When Display_AutoSize is enabled, selecting a VideoSize in the VideoSizes list resizes the control to the selected size.

Note

The size of the control can be stretched to a given percentage of the native video size with PreviewZoomSize. This property does not affect the frame capture size and the recording size.

Display aspect ratio

Video clips can have a display aspect ratio different from the frame aspect ratio. TVideoGrabber detects the display aspect ratio and takes it into account when the AdjustPixelAspectRatio property is enabled (see below).

In this case, the VideoWidth_PreferredAspectRatio and VideoHeight_PreferredAspectRatio properties return the preferred width and height that should be used to display the clip. These properties are useful to control the video size when Display_AutoSize is disabled.

To display the video in its correct display aspect ratio:

To display the video as is:

Location of the video frames within the video window

When Display_AutoSize = false, the aspect ratio is controlled by the Display_AspectRatio property.

The possible settings are:

  • ar_Box: the video appears in full within the control, in a letterbox (bars at the top and the bottom) or pillarbox (bars on the left and the right).
  • ar_NoResize: the video appears in its "native" size. If the native size is smaller than the control, the video appears centered within the control. If the native size is larger than the control, the video appears truncated.
  • ar_Stretch: the video is stretched as needed to fill the control.
  • ar_PanScan: the video may be panned or scanned, according to the Display_PanScanRatio value (in the 0..100 range, default value 50).

Zooming the frame capture

The size of the captured frames can be stretched to a given percentage of the native video size with FrameCaptureZoomSize.

Video capture devices

VideoSizes returns the list of video sizes actually supported by the current video capture device (e.g. 320x240, 352x288, 640x480, etc.).

Recording size

The recording size depends on the VideoSize property, except when UseNearestVideoSize is used.

Refreshing the video sizes

Any listbox that uses the video sizes of the current video capture device should be refreshed with VideoSizes (VideoSize is the current index in this list) when the OnVideoDeviceSelected event occurs.

See the MainDemo project for sample code.

Custom renderer

If the video display board is shipped with a custom renderer, TVideoGrabber can be told to use it.

To do so, invoke the ThirdPartyFilter_AddToList function before invoking StartPreview, and pass the CLSID of the third-party filter, e.g.:

...
uses ComObj;
...
procedure TfrmMainForm.Button1Click(Sender: TObject);
const
  CLSID_MyRendererFilter: TGUID = '{70e102b0-5556-11ce-97c0-00aa0055595a}';
begin
  if VideoGrabber.ThirdPartyFilter_AddToList (tpf_VideoRenderer, GUIDToString (CLSID_MyRendererFilter), '', 'rndr', true, false) then begin
    ShowMessage ('filter added');
    VideoGrabber.StartPreview;
  end;
end;

For help retrieving the CLSID of the renderer filter, feel free to contact us at support@datastead.com.