Issue was caused by rc_initial_buffer_occupancy being set for context
Commented this option for now -- it's not used in ffmpeg.c.
Now encoding seems to be working nice for MPEG4 and other codecs as well.
However, if there're some gurus around please check :)