I have put one condition in my code
-----------------------------------------------------------
if(!writer)
printf("errorrrrrrrrrrrrrrrrr");
------------------------------------------------------------'
this condition becomes true in my code, it means video write is not created.