Back when I first got my Nexus 4, I found that the Android Mediaserver process was using up quite a bit of my battery. There were a few proposed explanations for this odd behavior, including the idea that corrupt media files or background apps caused the service to run too much. Whatever the cause, the unnecessary battery drain was quite annoying, and I only got rid of it when I switched to CyanogenMod.
However, now there is a simple and easy way for rooted stock Jelly Bean users to end the battery drain caused by the Mediaserver process. Thanks to an XDA member, a simple script has been created that runs three commands which kill the Mediaserver process and prevent it from draining the Nexus 4′s battery. Since the Mediaserver will restart when media is played, it is necessary to either manually execute the script every hour or so, or use int.d to automate the process. In addition, there is a .zip file provided that should add the script to int.d so that it will work automatically.
This is certainly something of a brute force solution, but for those still suffering from unnecessary battery drain, it is likely the simplest option. Fewer users seem to be having trouble with excessive battery drain on the Nexus 4 since the latest update, but for some it still persists. I haven’t noticed any ill effects of killing the Mediaserver process, since it will start itself again when needed, so for anyone who is having trouble with the Nexus 4′s battery life, this may be worth a try.