Late to the party, but this line did it for me:
int64_t pts = av_rescale_q(_frameCount, codecContext->time_base, videoStream->time_base);
Where _frameCount increases every recording frame.