Often your Media scanner can misbehave and eat lot of CPU, Battery un-wantedly.
I had been digging out how to fix it, and here are my solutions. Perhaps try al of them, it would definitely relieve your cpu and battery usage by large. Solution works on any Android version:
Solution 1. Clear media storage data
Settings > applications > Media Storage > clear data, force stop and reboot.
Solution 2. Remove unwanted media files
Navigate to /sdcard/DCIM/.thumbnails and delete all files. Repeat for external sd card.
On AOSP roms, Android gallery creates too many of thumbnails that later becomes problematic for media scanner.
Solution 3. Analyze and delete excessive media files
Find out what files are causing media scanner to go mad.
Use any sdcard analyst (I use ES file manager > menu > Sd card analyst) to determine which directory has lots of files/subdirectories inside it. Any directory having >1000 files/folders is an alarmingly high number. Get rid of them (if you can).
Solution 4. Probe and delete bad/damaged media
If you're sure you've tried above solutions and still encountering battery drain, its time to dig deeper with developer tools.
Pre-requisite: You must be rooted, and have android developer tools (adb) setup.
With ADB tools installed, enter shell and acquire su permissions
adb shell su
top -grep media
130|[email protected]:/ # top | grep media
1905 0 10% S 7 23080K 6168K bg media /system/bin/mediaserver
2808 0 40% S 3 3524K 740K media_rw /system/bin/sdcard
2825 0 9% S 19 255832K 43936K bg u0_a5 android.process.media
lsof | grep media_rw
Once you get rid of such files, Its guaranteed media server would finish scanning soon enough.
Solution 5: Format SD cards
If nothing works (or you're too lazy of trying solution 4): Take backup and format Internal, external sd card and copy only selective files/folders that you need. Problems would go away for sure.
Solution 6: Disable Media scanner
If your Droid is against you and it just won't tame, its time to disable the media scanner. You can do this from adb shell
pm disable com.android.providers.media/com.android.providers.media.MediaScannerReceiver
Have fun, Droid is your friend