My webcam randomly stops outputting to octoprint

I am using a usb webcam and lately it would randomly stop outputting video feed and octolapse stops making snapshots but the built in time-lapse still gets photos. Also octoeverywhere also doesn't see the webcam either. If I restart octoprint then it fixes and you can see the video feed.