I have a high framerate camera which can capture >2000 fps. My plan was to assign actual capture timestamps with µs resolution to the frames and encode with H.264 in a matroska file.
So I set the time_base of both the AVStream and the AVCodecContext to {1, 1'000'000}. But after calling avformat_write_header(avFormatContext, nullptr) I notice that the stream's time_base is {1, 1'000}. Now, since my framerate is double this resolution, I get identical consecutive timestamps and half my frames get lost when I extract them from the video file.
Does anyone have an idea why this is happening and what I can do about it? Preferably in a way that preserves the correct timestamps.