ffmpeg: update timestamping code to handle frame threads