UB0241 can't get 60 fps at resolutions higher than 320x240 when using Ubuntu 20.04

Amazon
2. Model number of the product(s)?
UB0241
3. What hardware/platform were you working on?
It works fine with Windows, but I am using Ubuntu 20.04. I am making a custom application using OpenCV Python.I also tried using the “cheese” utility tool.
4. Instructions you have followed. (link/manual/etc.)

  1. Problems you were having?
    It works fine on my Windows machine and can record the video in 60FPS.
    However, on my Linux machine I can only get 30 fps.

  2. The dmesg log from your hardware?

# Python program to save a 
# video using OpenCV 


import cv2 
import os

# Create an object to read 
# from camera 
video = cv2.VideoCapture(0, cv2.CAP_V4L2) 
video.set(cv2.CAP_PROP_FRAME_WIDTH,640)
video.set(cv2.CAP_PROP_FRAME_HEIGHT,480)
video.set(cv2.CAP_PROP_FOURCC,60)

# We need to check if camera 
# is opened previously or not 
if (video.isOpened() == False): 
	print("Error reading video file") 

# We need to set resolutions. 
# so, convert them from float to integer. 
frame_width = int(video.get(3)) 
frame_height = int(video.get(4)) 

size = (frame_width, frame_height) 
print(size)
# Below VideoWriter object will create 
# a frame of above defined The output 
# is stored in 'filename.avi' file.
path="saved_videos"
vid_name="video.avi"
vid_counter=0
result = cv2.VideoWriter(os.path.join(path,vid_name),cv2.VideoWriter_fourcc('M','J','P','G'), 60, size)

	
while(True): 
	ret, frame = video.read() 

	if ret == True: 

		# Write the frame into the 
		# file 'filename.avi' 
		result.write(frame) 

		# Display the frame 
		# saved in the file 
		cv2.imshow('Frame', frame) 

		# Press S on keyboard 
		# to stop the process 
		if cv2.waitKey(1) & 0xFF == ord('s'): 
			break

	# Break the loop 
	else: 
		break

# When everything done, release 
# the video capture and video 
# write objects 
video.release() 
result.release() 
	
# Closes all the frames 
cv2.destroyAllWindows() 

print("The video was successfully saved")

  1. Troubleshooting attempts you’ve made?

  2. What help do you need?
    get 60 fps at resolutions higher than 320x240 when using Ubuntu 20.04

Hi,
I ran your script this morning and saved a video in framerate 60.

Hi,
You also can check the screen_Record.mkv. I replicated it this afternoon. It will show lower framerate when previewing, but it will return to 60fps when saved.
https://drive.google.com/drive/folders/1KA65dNuw31snRWYcQULnle5ugY96jb9D?usp=share_link