The proper way to determine what is causing this is to go through the process of elimination.
Since you mentioned about AVI and Real Media file formats, I assume these are the only 2 format
types you are having problems with unless you specify there is other formats involved.
Separate the files according to their format type. Once you are finished with that
fire up your burning software and try burning it again.
If the error message comes up when your trying to burn AVI files then
this could be the problem. But if it's not then it could be the your Real Media files.
If both file formats cannot be burned successfully even if you separate them.
You will have to look what other factors might cause this.
One way is to do what Tatsumi09 has told you, update your drive's firmware.
Some DVD writers won't accept certain brand media while other even with
update firmware won't accept that type of brand media at all.
The other is to update your burning software.
The 2 most common used is made by either Nero or Roxio, both of them should have
update on their site.
Download the latest update(s) or patch(s) (according to your software version) and
see if that helps.
If that still does not help, then few easy options you can try to do is...
-Try a different type of blank media
-Try a different type of burning software (Some have trial downloads)
-Try the burning software that is built in your operating system
(assuming you are using Windows XP).
One important thing you say in detail is when does your drive spit out your blank disc
because if it spits out during the copying phase... like what TSPhoneix mentioned
it could possibly mean you have corrupted file(s).
Sometimes file(s) may play perfectly fine, but that does not necessarily mean they
can be burned successfully.