High cpu usage from Finder/QTKitServer when you open a folder with mkv files

Hi all

As some of you may have noticed, if you have installed Perian and have a folder full of mkv files, Finder and QTKitServer will go a bit crazy when you open this folder. This is because they are trying to create thumbnail images for the movies automatically and most of the time fail on mkv files or broken avi files, thus causing the high cpu/disk thrashing (often even after you’ve closed the folder).

There is a fix for this, but I must warn you not to do any of this if you arent comfortable modifying system files. I have tested it on my own system with good results however.

OSX has a sandbox layer in which almost all processes run, including system processes. This sandbox has rules and by modifying those rules, we can change how things work. In this case we are changing the rules so that QTKitServer will not be able to touch mkv files. Note that this may also have the side effect of you not being able to open mkv files in QuickTime anymore, in which case just use VLC or some other movie player instead.

If you are ready to proceed, do the following:

Open Terminal, type:

sudo nano /System/Library/Sandbox/Profiles/com.apple.qtkitserver.sb

This will open the nano editor with the rules file. Scroll right to the bottom of this file and enter:

(deny file-read* (regex #”^.*\.mkv$”))

After this do Ctrl-O and then Ctrl-X to save and exit the application.

The effect will be immediate and you should have no more issue with thumbnail generation going crazy in a folder with mkv’s. It will not affect any other video or audio files.

Again if you arent comfortable in terminal or with modifying system files, I would suggest not doing this yourself. For everybody else, I hope this helps

Reference: http://forums.macrumors.com/showthread.php?t=1463364

发表评论