Encoder timebase is equal to the frame timebase, so does not need to be passed separately. Also, rename in_picture to frame, which is shorter and more accurate - it always contains a frame, never a field.