In the same function where you draw the rectangle that indicates the face, save the coordinates to a global variable. Then, when saving the frame to the file, limit its area like this: video_frame[y:y+h, x:x+w], see detail:
def detect_bounding_box(vid): global area gray_image = cv2.cvtColor(vid, cv2.COLOR_BGR2GRAY) faces = face_classifier.detectMultiScale(gray_image, 1.1, 5, minSize=(40, 40)) for (x, y, w, h) in faces: cv2.rectangle(vid, (x, y), (x + w, y + h), (0, 255, 0), 4) area = [x, y, w, h] return faces
........
cv2.imwrite(img_name, video_frame[area[1]:area[1]+area[3], area[0]:area[0]+area[2]])