I make a mistake in writing. Parameter pCodecCtx->max_b_frames is equal to 2
not to 8 as I wrote. I added some other settings:
pCodecCtx->intra_dc_precision = 10;
pCodecCtx->rc_max_available_vbv_use = 1;
pCodecCtx->rc_min_vbv_overflow_use = 1;
but nothing changes.