Now when you run it, select the game you want to play (assuming you have the romset), click Play and Record AVI from the drop down File menu, and select the codec. Uncompressed and Intel IYUV are pretty much the only way to go on this front. I suggest IYUV since it's still lossless and takes up much less space than Uncompressed.
Hit the Home key to begin and end recording at any time when the game is running.
Now when you get done, playing, the resulting AVI will be in the /avi subfolder of the directory that you have EK-MAME in. Drag and drop that bad boy into VirtualDub, select the range you want to encode (home for selection start, end for selection end), and then do a two stage encode to XviD (or DivX, if you really insist on using that for whatever reason). Don't forget to encode the audio! (96kbps is just fine for most of these games).
Post your results (or if you need further clarification on how to use VirtualDub, let me know. I take a lot of details for granted since I've been using it for a few years to do basic encoding). Hell, if you want you can use Windows Movie Maker, too

Introduction Sequence for Pulstar
Introduction sequence for Gunlock/RayForce
(off Topic)
Golden Axe US Attract Mode
Infamous decapitation scene from the japanese attract mode of Golden Axe