Android 4.4 has a new screen recording function for developers, but as the CyanogenMod team has already demonstrated, it can be adapted for more general use. Well-known developer Koushik "Koush" Dutta has taken advantage of this for Mirror, a new screencasting app for KitKat that allows any rooted user to either record video directly on a device, or stream to an Apple Airplay-compatible receiver like Apple TV. No custom ROM required.
Right now you must have Android 4.4.2 and root privileges, but Koushik says he's working on a method for non-root use with a PC USB tether, and eventually he hopes that the application will be compatible with Android 4.1 and later. At present the app works surprisingly well. Install it and it will automatically move itself to the system partition, then you can start and stop videos with a single tap. I don't have an Apple TV to test it with, but local recording (including microphone audio) is almost flawless.
To try Mirror you'll need to join the ClockworkMod Google+ group, then sign up for the beta. Once you do that you'll have access to the Play Store listing and an easy download. You might also want to join to find out when a root-free option or a build for older Android versions becomes available.
Source: Koushik Dutta (Google+)