Skip to content

Video clip built from a fixed set of BMP files or JPEG files

To create a video clip from a set of bitmap (BMP) files or JPEG files, a temporary file must first be created from the set of images.

Then it is possible to:

  • preview the video built from the temporary file,
  • record a video clip built from the temporary file to an AVI or ASF file.

Create a temporary file from the BMP files or JPG files

Create a set of images

Create a set of images as BMP or JPEG files and put them in an empty directory (e.g. set StoragePath to a new directory name, go to the "frame capture tab" and capture 20 frames to JPG files in burst mode).

These files must all have the same format (all BMP or all JPG, same frame width and height, same color resolution).

The format used is the format of the first video frame found in the directory. Other video frames that do not have the same format are ignored.

Specify the location of the image files

Assign the directory containing the image files to VideoFromImages_SourceDirectory, e.g.:

VideoGrabber.VideoFromImages_SourceDirectory = "c:\MyImagesFolder"

Specify a sorting method for the image files (optional)

Choose a VideoFromImages_BitmapsSortedBy value, e.g.:

VideoGrabber.VideoFromImages_BitmapsSortedBy = fs_NameAsc

Numeric sequences must be "zero padded", e.g.:

001.bmp
002.bmp
003.bmp
...
009.bmp
010.bmp
011.bmp
...
098.bmp
099.bmp
100.bmp
101.bmp
...

Choose and specify the temporary file

Choose the temporary file that will be created from the image files, and assign its name to the VideoFromImages_TemporaryFile property, e.g.:

VideoGrabber.VideoFromImages_TemporaryFile = "MyTempFile.dat"

Create the temporary file from the set of bitmaps

Invoke VideoFromImages_CreateSetOfBitmaps.

This function returns true on success; the temporary file can then be used immediately in the next steps below, or reused later.

Sample code:

procedure TfrmMainForm.CreateTempFileClick(Sender: TObject);
begin
  VideoGrabber.VideoFromImages_BitmapsSortedBy:= fs_NameAsc;
  VideoGrabber.VideoFromImages_SourceDirectory:= 'MyImagesFolder';
  VideoGrabber.VideoFromImages_TemporaryFile:= 'MyTempFile.dat';
  VideoGrabber.VideoFromImages_CreateSetOfBitmaps;
end;

Preview the video built from the temporary file

  1. Select the temporary file as live video source: set VideoSource = vs_VideoFromImages.
  2. Specify the temporary file to use, e.g. VideoFromImages_TemporaryFile = "MyTempFile.dat".
  3. Specify whether the preview must stop at the end of the image files or repeat from the beginning, e.g. VideoFromImages_RepeatIndefinitely = False.
  4. Choose a frame rate, e.g. set FrameRate = 15.
  5. Start the preview: invoke StartPreview.

Sample code:

procedure TfrmMainForm.startpreviewClick(Sender: TObject);
begin
  VideoGrabber.VideoSource:= vs_VideoFromImages;
  VideoGrabber.VideoFromImages_TemporaryFile:= 'MyTempFile.dat';
  VideoGrabber.VideoFromImages_RepeatIndefinitely:= False;
  VideoGrabber.FrameRate:= 10;
  VideoGrabber.StartPreview;
end;

Record a video clip built from the temporary file to an AVI or ASF file

  1. Select the temporary file as live video source: set VideoSource = vs_VideoFromImages.
  2. Specify the temporary file to use, e.g. VideoFromImages_TemporaryFile = "MyTempFile.dat".
  3. Specify whether the recording must stop at the end of the image files or repeat from the beginning, e.g. VideoFromImages_RepeatIndefinitely = False.
  4. Choose a frame rate, e.g. set FrameRate = 15.
  5. Choose the recording method, and specify whether to use a video and/or audio compressor.
  6. Start the recording: invoke StartRecording.

Sample code:

procedure TfrmMainForm.startrecordingClick(Sender: TObject);
begin
  VideoGrabber.VideoSource:= vs_VideoFromImages;
  VideoGrabber.VideoFromImages_TemporaryFile:= 'MyTempFile.dat';
  VideoGrabber.VideoFromImages_RepeatIndefinitely:= False;
  VideoGrabber.StoragePath:= 'VideoStorageFolder';
  VideoGrabber.CompressionMode:= cm_NoCompression;
  VideoGrabber.FrameRate:= 10;
  VideoGrabber.StartRecording;
end;