Help with the source recorder

After having recorded some demos, the next step is usually to convert them to readable movie files using the “startmovie” command. But when I type the command “startmovie <name of movie> avi”, the little codec selection window only pops up less than half of the time. I keep having to change the name of the movie randomly until it finally works and I can convert some demos. This method is really annoying and tedious. Is there a solution or workaround? Perhaps a way to set the codec as a part of the console command?