Code refactoring to set the capture width in handle_frame function using the video frame API