Timecodes were generated from read packets, but applied to decoded frames. This works as long as delay between packet read and decoded frame is less than GOP size or if packet does not produce multiple frames. In this case it did not work. Use `pkt_pos`, `pkt_dts` and `pts` from `AVFrame` instead of `AVPacket`. This way delay can be eliminated and timecode files are more reliable.