change all frame_to_pixel and pixel_to_frame to sample_to_pixel and pixel_to_sample