implemented pad before or after for fix_frame_count