03-27-2013, 05:37 AM
Hi,
I trying to create AVI files, using the VLRecordedBitmapDemo as example (and using BMDThread instead of TThread). I manage the code in a separate unit so I instantiate the component in code :
VLGenericFilter := TVLGenericFilter.Create(nil);
VLAVILogger := TVLAVILogger.Create(nil);
VLGenericFilter.OutputPin.Connect(VLAVILogger.InputPin);
VLAVILogger.Compression.Enabled := True;
Then I use a similar loop as in the demo to write the frames
while not Thread.Terminated do
begin
// Sync with VCL to get the currenty image
Thread.Synchronize(RecThreadSync);
// Write it to the AVI
// Create a image buffer.
ABuffer := TVLImageBuffer.CreateBmp(FRecImage);
// Send the buffer.
VLGenericFilter.SendData( ABuffer );
end;
However this generates, even with the compression enabled, very big files. I tried to slow down the sending of the frames by adding a Sleep(40) command in the loop. Then the files are effectively smaller, but synchronization is wrong (they movie plays too fast).
What is the proper way to slow down the frame pumping, and still to keep the timing correct ?
Thanks,
soitjes.
I trying to create AVI files, using the VLRecordedBitmapDemo as example (and using BMDThread instead of TThread). I manage the code in a separate unit so I instantiate the component in code :
VLGenericFilter := TVLGenericFilter.Create(nil);
VLAVILogger := TVLAVILogger.Create(nil);
VLGenericFilter.OutputPin.Connect(VLAVILogger.InputPin);
VLAVILogger.Compression.Enabled := True;
Then I use a similar loop as in the demo to write the frames
while not Thread.Terminated do
begin
// Sync with VCL to get the currenty image
Thread.Synchronize(RecThreadSync);
// Write it to the AVI
// Create a image buffer.
ABuffer := TVLImageBuffer.CreateBmp(FRecImage);
// Send the buffer.
VLGenericFilter.SendData( ABuffer );
end;
However this generates, even with the compression enabled, very big files. I tried to slow down the sending of the frames by adding a Sleep(40) command in the loop. Then the files are effectively smaller, but synchronization is wrong (they movie plays too fast).
What is the proper way to slow down the frame pumping, and still to keep the timing correct ?
Thanks,
soitjes.