If your MacBook is running Mojave or a later operating system, you can do this with the Screenshot app. Launch it by holding down Shift + Command + 5, then select one of the Screen Record options. If you're using an older operating system, you can do it by downloading a third-party screen recording app.