I created this video after a bit of trial and error (and research!) that demonstrates how to set up CamStudio 2.x so that the audio and video stay in synchronization throughout the length of the video.
Although I mention in this video just using the Microsoft Video 1 codec, I now feel that either the Camstudio Lossless Codec or Xvid/DivX or FFDShow are the easiest to use with good quality.
There are videos on YouTube for best DivX and other codec settings you can also check out. (Just search)
In a Nutshell:
Avoid audio/video sync problems – use 25 for the “Capture Frames Every” setting and 40 for the “Playback Rate” preferably using a 16-bit display color setting for fastest/smoothest playback rate (see the rest of this article to understand why…) This setting produces very smooth results, albeit with large-ish file sizes.
Truth be told, I even make great screen recordings using 100 for the “Capture Frames Every” setting and 10 for the “Playback Rate” setting, also with perfect video/audio sync, which produces much smaller file sizes.
Three test recordings, no motion, 30 seconds each at 1280X720, with 16-bit color using CamStudio Lossless 1.5
SKFE=25 CFE=25 PBR=40 produces a 12.9 Meg file
SKFE=200 CFE=25 PBR=40 produces a 4.95 Meg file
SKFE=25 CFE=40 PBR=25 produces a 10.5 Meg file
SKFE=200 CFE=40 PBR=25 produces a 4.15 Meg file
SKFE=25 CFE=100 PBR=10 produces a 4.4 Meg file
SKFE=200 CFE=100 PBR=10 produces a 2.37 Meg file
SKFE=”Set Key Frames Every” CFE=”Capture Frames Every” PBR=”Playback Rate”
The Whole Story:
Getting CamStudio to synchronize the video to the audio requires that the “Playback Rate” in Video Options divides evenly into 1000 milliseconds, the result of that division being placed in the entry that goes in the box above it, “Capture Frames Every”. This must be a whole number (no fractions). This basically means that you have five options for playback rate/frames per second (as CamStudio does not allow fractional entries in the “Capture Frames Every” box).
You must use, therefore, 40 milliseconds with 25 frames/sec, or 50 milliseconds with 20 frames/sec, or 100 milliseconds with 10 frames per second, or, if you are a mad scientist, 20 milliseconds with 50 frames/sec or 25 milliseconds with 40 frames/sec. The first two settings mentioned are plenty adequate for 90% of applications, though. Any other settings will cause a lag to develop in the audio that will get worse and worse as time passes.
This helpful information came from the following two links as sources: http://en.wikibooks.org/wiki/Screencasting_with_CamStudio
Though I’ve seen it often stated that you can use 15 fps with a “Capture Frames Every” setting of 66, that still sums to 990 (15 X 66), as does 30 fps and 33 (30 X 33). Those settings will slowly cause lagging to occur. I haven’t tested whether it will matter sufficiently in a 10-minute-MAX YouTube video yet, but it probably will be a problem even at that length. The settings that multiply to equal 1000 are the best optimized ones, as 1000 milliseconds is equal to 1 second, but 990 milliseconds is clearly not!
I hope people find that helpful, and try to create their own screencasts.
[Edit: 03/23/10] Although these settings keep the sound and video in sync, they are not the only important ones. It is important to also set your video display settings in Windows so that “Hardware Acceleration” is turned completely off to avoid mouse jitter issues and other problems. Open the Display Settings control panel (right-click on the desktop background and select “Properties”), then select the “Settings” tab. From there, select the “Advanced” button. Once in there, select the “Troubleshoot” tab, where you will find the “Hardware Acceleration” slider. Slide that all the way to the left and hit the “Apply” button. Don’t forget to set this back again when you are done screen recording. For recording Games and such (and certain media player’s output), you may have to try setting the slider at higher settings for game or video playback functionality to be adequate.
I can also heartily recommend the following video series by phosgram: http://www.youtube.com/watch?v=vNbSSFJlImo
The following is from a post I did at the Camstudio Forums ==> http://camstudio.org/forum
Since CamStudio does not allow for decimal settings in its setting of “Capture Frames Every”, another factor necessary to consider to stay in sync is the relationship of the “Capture Frames Every” setting to that of “Playback Rate” The two, when multiplied, must result in an even number of 1000 (1000 milliseconds, or one second).
(In speculation, this may be because audio uses an H:M:S:mS framework while video uses an H:M:S:F (F for “Frames”) timing system.)
This limits the available “Capture Frames Every” (CFE) and “Playback Rate” (PBR) settings to the following:
125 8 *
100 10 *
50 20 *
40 25 *
25 40 *
20 50 *
( * marks those which are perhaps most practical.)
(Note: The first two are time-lapse settings, the first one capturing every second, the second one capturing every half-second.)
Since the typical ACTUAL possible frame capture rate is usually around 10 to 20 fps, one would think that setting to CFE 100/PBR 10 would be the best (and it might be!) But you can push your machine to perform a little harder by setting higher figures here in the Playback Rate, say like CFE 25/PBR 40 or even higher (20/50, 10/100, etc.). Experiment here! The key issue is how the math is performed … since trying for a Playback Rate of 30 fps allows for only a non-fractional setting of 33 in the CFE, you wind up with a multiplication result of 990, which would guarantee a lag would be introduced over time that would get worse and worse.
This does not negate the fix using VirtualDub mentioned above at all, but it might make the repair unnecessary for most people’s situations. There are other factors besides the CFE/PBR relationship that can break sync (like dropped frames due to computer disk and pageswap I/O activity and such – realtime capture is a very demanding task on the poor processor!) But this one move has helped many people overcome audio lag completely (as seen in the comments on my above video at YouTube: http://www.youtube.com/watch?v=XhowEhUPClc )
The other “big move” that has helped many folks is additionally checking the box in Audio Settings in Camstudio that says “Use MCI for Recording”, which forces Camstudio to use your system’s native recording methods, bypassing the compression features in Camstudio. You can compress your audio as a separate pass in Virtual Dub with audio set to “Full Processing” mode at a later time.
These two approaches used together have eliminated audio sync issues for a majority of applications. Let me know if they are working for you … or, in fact, WHAT is working for you! 🙂
“Set Key Frames Every:”
Any media player should exhibit a “progress bar” at the bottom which your audience can use to back-up or fast-forward to wherever they’d like. Even the flash players have this unless you specifically set them up not to show it.
Keep the “Set Key Frames Every” setting around 30 frames for the best control, though this low a setting will result in a higher file size. (Set this in Options/Video Options)
From the docs:
“Set Key Frames Every”
“This setting specifies the keyframe rate. When a frame is saved in an AVI file, they can either be saved as a full frame, or only partially as a difference to the previous frame. The keyframe rate specifies how often full frames are written to the AVI file. A high value means you can fast forward/rewind to a particular frame in your movie much faster. But it also means a higher file size.”
I should add that the last two sentences from the docs are quite confusing. They remind me of my famous saying for which I am still known to this day, that being:
“Although the moon is smaller than the Earth, it is further away.”
In an attempt to clarify what is intended by those statements (not the moon one, though):
Higher settings result in coarser control (and faster seeking), and lower file size.
Lower settings result in finer control (and slower seeking), and higher file size.
Two test recordings, no motion, 30 seconds each at 1280X720, with 16-bit color using CamStudio Lossless 1.5, CFE=40 PBR=25
Set Key Frames Every set to every 25 frames = 10.5 Meg file
Set Key Frames Every set to every 200 frames = 4.15 Meg file