Extracts of my code for results above:
FT = (640,480) #tracking frame size
FW = (1024,720) #writing frame size
# Open devices
video = cv.VideoCapture(0)
video.set(cv.CAP_PROP_FRAME_WIDTH, FT[0])
video.set(cv.CAP_PROP_FRAME_HEIGHT, FT[1])
output = cv.VideoWriter('OCVF.avi',cv.VideoWriter_fourcc(*'XVID'), int(25) , (int(video.get(3)), int(video.get(4))))
#output did not save when using FW in place of video.get 3,4
Then in loop:
while True:
# Read a new frame
ok, frame = video.read()
output.write(frame)
frame = cv.flip(frame, -1)
framer = cv.resize(frame,FT)
# Update tracker
ok, bbox = tracker.update(framer)
# Display result
cv.imshow("Tracking", framer)