Dropped frames and audio/video sync problems
DROPPED FRAMES
The live video and audio sources stream data at a fixed frame rate, and this means that the processor must have finished processing the previous frame when the next frame arrives, otherwise the frame is dropped and replaced by a blank frame.
The dropped frame count can be retrieved by reading the DroppedFrames property.
Because reading the dropped frames requires a variable amount of CPU (depending on the video capture device), the number of dropped frames is not updated for every frame, but refreshed periodically according to the DroppedFramesPollingInterval property (specified in seconds).
E.g:
DroppedFramesPollingInterval = 20 polls the dropped frames count every 20 seconds.
DroppedFramesPollingInterval = 0 disables the polling of dropped frames (recommended to save CPU).
Disk access
During recording, one major problem is the block allocation when the operating system extends the recording file. When allocating new blocks, the operating system places significant demands on the CPU/disk resources, and this can cause dropped frames.
This problem occurs mainly when capturing uncompressed video in AVI format. It is less significant when using a video compressor on the fly (or when recording in ASF format), because the file size is 10 or more times smaller.
The best solution to avoid this problem is to record to an SSD (if a lot of disk space is needed for multiple recordings, once recorded move the video clip from the SSD to a normal HDD, so the SSD is used only as a temporary disk just for the recording).
FAT 32 is not efficient for large capture files, generating large numbers of dropped frames when new disk blocks are allocated.
Always choose NTFS partitions, on disks with fast access time and cache memory.
Frame grabber
The frame grabber adds an additional step in the stream processing, and therefore requires more CPU.
When there is no need to capture frames or perform text or graphics overlays during recording, simply disable it by setting FrameGrabber = fg_Disabled before invoking StartRecording.
Audio rendering
During recording of video + audio streams, if possible, disable AudioDeviceRendering, which renders the sound through the loudspeakers. This will let TVideoGrabber capture the video and audio streams without having to split the audio stream. Audio rendering must be disabled before invoking StartRecording.
Video Display
In order to save CPU it is possible to disable the video window during the recording. Simply set VideoRenderer = vr_None before invoking StartRecording.
Video size and frame rate
Of course, the larger the video size and the higher the frame rate, the higher the CPU and disk consumption. Reducing the video size to 320x240 and the frame rate will help fix audio sync problems.