Hello, If we assume x/y is the num/den of the incoming stream and a/b is the num/den of the mpeg rate table The formula in find_frame_rate_index tries to minimize 1001/b*a*x-1001*y whereas it should try to minimize 1001/b*a*y-1001*x (i.e. time_base.num/den seems inverted) Thanks