Video window

Prev

Next

 






































































































Video size overview.

Description

Video render
You can choose the video renderer through the VideoRenderer property:
vr_AutoSelect: selected automatically
vr_VMR9: video renderer 9 (VMR9) -> good quality, more CPU. It buffers 3 frames, this can cause positionning problems in the player.
vr_VMR7: video 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

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 start displaying video frames.

Show / hide the video window
Enable Display_Active to specify if the video window must be constructed when invoking StartPreview / StartRecording / OpenPlayer.
Then the video window can be shown or hidden when the preview/recording/playback is running by enabling or disabling Display_Visible.

Size of the video window & auto resizing
The control is automatically resized by TVideoGrabber when Display_AutoSize is enabled, otherwise it depends of the Width and Height properties.
When Display_AutoSize is enabled:
- selecting a VideoSize in the VideoSizes list resizes the control to the selected size,
remark: the size of the control can be stretched to a given percent of the native video size by using 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 than the frame aspect ratio. TVideoGrabber detects the display aspect ratio and takes it in account when the AdjustPixelAspectRatio property is enabled (see below).
In this case, the VideoWidth_PreferredAspectRatio and the VideoHeight_PreferredAspectRatio properties return the preferred width and height that should be used to display the clip. These properties are useful if you want to control yourself the video size when Display_AutoSize is disabled.

To display the video in its correct display aspect ratio:

- if you want the control to be resized automatically, set AdjustPixelAspectRatio = true and Display_AutoSize = true

- if you want to specify yourself the size of the control, set AdjustPixelAspectRatio = true and Display_AutoSize = false,
and read the VideoWidth_PreferredAspectRatio and VideoWidth_PreferredAspectRatio properties from the OnPlayerOpened event to get the correct video width and height of the video clip.

To display the video AS IS:

- if you want the control to be resized automatically, set AdjustPixelAspectRatio = false and Display_AutoSize = true

- if you want to specify yourself the size of the control, set AdjustPixelAspectRatio = false and Display_AutoSize = false and Display_AspectRatio = ar_NoResize
and read the VideoWidth and VideoHeight properties from the OnPlayerOpened, OnPreviewStarted or OnRecordingStarted events.

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 on 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 larger than then control, it 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: from pan to tilt, according to the Display_PanScanRatio value (in the 0..100 range, default value 50).

Zooming the frame capture
The size of captured frames can be stretched to a given percent of the native video size by using FrameCaptureZoomSize .

Analog video sources
For non-DV video sources, VideoSizes returns the list of video sizes really supported by the current video capture device (e.g. 320x240, 352x288, 640x480, etc...)/

DV video sources
DV video sizes are standard.
When the current video capture device is a DV source, the VideoSizes returns "dc", "quarter", "half" and "full". The resulting video size depends of the video signal (PAL or NTSC):

VideoSizes list     NTSC       PAL
default           360x240    360x288
dc                 88x66      88x72
quarter           180x120    180x144
half              360x240    360x288
full              720x480    720x576

Recording size
The recording size depends of the VideoSize property, except when UseNearestVideoSize is used.
However, when capturing DV video sources and RecordingInNativeFormat is enabled, the video stream is always saved to AVI in "full" size, and VideoSize and UseNearestVideoSize apply in this case only to the preview control size.

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.

Video quality under Windows Vista / Windows 7 and later

It is possible to improve the quality of the video display (e.g. in full screen mode) when playing MPEG clips and the frame grabber is disabled, see the Aero property.

Custom renderer
If your video display board is shipped with a custom renderer, you can tell TVideoGrabber to use it.
You have to invoke the ThirdPartyFilter_AddToList function before invoking StartPreview, and pass the CLSID of your 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) > -1 then begin
      ShowMessage ('filter added');
      VideoGrabber.StartPreview;
   end;
end;


Feel free to contact us at support@datastead.com if you don't know how to retrieve the CLSID of your renderer filter.



See Also
GetNearestVideoHeight GetNearestVideoSize GetNearestVideoWidth GetVideoHeightFromIndex GetVideoSizeFromIndex GetVideoWidthFromIndex UseNearestVideoSize VideoFormat VideoFormatIndex VideoSize VideoSizeIndex VideoSizes VideoSizesCount