You can use "Ctrl-SPACEBAR" to start movie-mode in X-Plane, which is basically like an integrated X-Plane screen recorder. Make sure you change the settings though... the default movie settings are quite low. Both the "Replay" function and "Movie" function have drawbacks, naturally. The "Replay" function does not always re-simulate some data from aircraft, especially add ons (such as lights, wing flex, etc), while the movie feature can lag, and I don't believe it records audio. Some people record movies during "Replay', but then you are limited to the constraints of the "Replay" function.
For actually recording a 3 hour flight, you will find that most YouTubers simply use a third-party screen-recorder program. Bear in mind that a 3-hour screenrecorded flight from X-Plane will generate a massive, massive file.