static AVRational getTimeBase(AVStream stream, AVCodecContext codecCtx)
{
// code adapted from ffmpeg utils.c: dump_format
if (stream.r_frame_rate.num != 0 && stream.r_frame_rate.den != 0)
{ AVRational result = new AVRational();
result.num = stream.r_frame_rate.den;
result.den = stream.r_frame_rate.num;
return result;
}
else if (stream.time_base.num != 0 && stream.time_base.den != 0)