1. A method for capturing videos, comprising: setting a video capture class in a framework layer of a programming language, the video capture class inheriting a class in a video capture bottom layer library and registering a callback function for the video capture bottom layer library; sending, by the video capture class, a video capture command to the video capture bottom layer library which starts to capture video data according to the video capture command; and obtaining the video data from the video capture bottom layer library by using the callback function, and sending the video data to an encoder to encode the video data.