There example on the net and code given in Learn OpenCv,Orielly.
After many attempts the out.avi file is written with 0 bytes. I wonder where i went wrong.
T
I think the problem you're encountering is that your "for" loop never ends; therefore, cvReleaseVideoWriter(&writer);
and cvReleaseCapture(&input);
never get called. Try something like for(int i=0; i<200; i++)
and see if you end up with a working video.
Often video is written to a temporary files before being finalized on disk. If your file isn't finalized, there won't be anything to see.
Hope that helps.