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

Prev

Next

 






































































































How to create a video clip from a set of bitmap or BMP files or JPEG files.

Description

How to create a video clip from a set of bitmap or BMP files or JPEG files.

First of all, a temporary file must be created from the set of images (step A).

Then, it is possible:
- to preview the video built from temporary file (step B)
- to record a video clip built from the temporary file to an AVI or ASF file (step C)


A. Create a temporary file from the BMP files or JPG files.

a1. create a set of images as BMP of JPEG files and put them in an empty directory.
These files must be all of 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. If other video frames have not the same format, they will be ignored.
(e.g. set StoragePath with a new directory name, go to the "frame capture tab" and capture 20 frames to JPG files in burst mode).

a2. specify the location of the image files:
assign the directory containing the image files to "VideoFromImages_SourceDirectory". E.g.:
VideoGrabber.VideoFromImages_SourceDirectory = "c:/MyImagesFolder"

a3. specify a sorting method for the image files (optional)
choose a VideoFromImages_BitmapsSortedBy value. E.g.:
VideoGrabber.VideoFromImages_BitmapsSortedBy = fs_NameAsc

Note: 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
...

a4. choose and specify the temporary file that will be created by using the image files
assign this file name to the VideoFromImages_TemporaryFile property. E.g.
VideoGrabber.VideoFromImages_TemporaryFile = "MyTempFile.dat"

a5. create the temporary file from the set of bitmaps:
Invoke VideoFromImages_CreateSetOfBitmaps .
This function will return true upon success and , that you can use immediately in the next steps below, or reuse 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;


B. Preview the video built from temporary file

b1. Select the temporary file as live video source
Set VideoSource = vs_VideoFromImages

b2. specify the temporary file to use
e.g.: VideoFromImages_TemporaryFile = "MyTempFile.dat"

b3. specify if the preview must stop at the end of the image files or repeat from the beginning
e.g. VideoFromImages_RepeatIndefinitely = False

b4. Choose a frame rate
E.g. set FrameRate = 15

b5. 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;


C. Record a video clip built from the temporary file to an AVI or ASF file (step C)

c1. Select the temporary file as live video source
Set VideoSource = vs_VideoFromImages

c2. specify the temporary file to use
e.g.: VideoFromImages_TemporaryFile = "MyTempFile.dat"

c3. specify if the preview must stop at the end of the image files or repeat from the beginning
e.g. VideoFromImages_RepeatIndefinitely = False

c4. Choose a frame rate
E.g. set FrameRate = 15

c5. Choose the recording method. Specify if you wish to use a video and/or audio compressor

c5. 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;



See Also
OnBitmapsLoadingProgress SendImageToVideoFromBitmaps SendImageToVideoFromBitmaps2 VideoFromImages_BitmapsSortedBy VideoFromImages_RepeatIndefinitely VideoFromImages_SourceDirectory VideoFromImages_TemporaryFile