Plex and Folding @ Home

Greetings Everyone,

I love my Plex server but since unfortunately I have to work and sleep I don’t spend all of my time on Plex. That being said one other thing I enjoy is dedicating un-used CPU cycles to the Folding @ Home project.

Unfortunately when F@H is running people I’ve shared my server with are unable to stream some videos due to the high demand in CPU usage for transcoding. Even when F@H is set to light (I’m running Plex on a Pentium D out of a Ubuntu Server OS).

What I’d like to develop is an app that can detect when Plex is being called upon for service and use the Telnet API in F@H to pause protein folding until Plex is idle again.

My question is (as I’m not familiar with any of the Plex API) what is the best event to latch on to from Plex to make this transition as quick and seamless as possible? Or is the best thing to do just to check for the task to appear in the cpu list for transcoding?

Thanks for your time!

I am no developer, so take this at face value until someone with brains helps you:
If I would do it I would do it one of these two ways:

Alternative 1: Continuously check Plex Media Server.log if this could be found 5 minute back in time:
/transcode/session/
If not, then it is safe to turn on F@H again. And when it is sensed in the log again, then turn it off.

Alternative 2: Check which processes is running. If Plex New Transcoder is running, then turn F@H off.

This is for CPU:s which only will have trouble when transcoding is active. With that weak CPU maybe you see issues even when someone is Direct Playing? If so, then you must check for other things that I am less capable of answering for. The only thing that pops into my mind is to check if the Plex Media Server.log is mentioning timeline in the last couple of minutes. If it has, then turn F@H off.

Sorry that I can’t be more of help.

Could use some sort of log file parsing, looking for specific lines in the log file that occur when a stream starts, regardless of transcode or DP.

Just a thought, anyway.

@atrus The CPU does just fine with running F@H while using direct play. It even has some success with transcoding some SD/720p h264 files. Oddly enough where it has most trouble is transcoding some older Mpeg4(DIVX/XVID era) files while F@H is running.

Also since this is running on Ubuntu Server 64bit with just a terminal and no GUI it even handles transcoding 1080P h264 when F@H is not running even with the older CPU.

@atrus & @MikeG6.5 Thanks for the info on the logs. I will look into the log files and see how quickly they are updated. If the process is called before it’s logged though it might be more beneficial to look for the process. Preferably I’d like to catch an incoming http request for a stream before it starts playing (Even if it is direct play) so that I can make sure Plex works it’s best while it’s being used and when it’s not working F@H is taking advantage of un-used CPU cycles at full capacity.

@andyrblank: Did you find a way to achieve this? I have the exact same problem and am hoping you found a solution :slight_smile:

@hshah I haven’t had time to spend on development. Probably more of a Winter project for me but as soon as I do find a solution I will post back here and also probably on my blog: http://blankstechblog.wordpress.com/

@andyrblank: I’m going to look into it as well, so if I come up with anything I will post back here too :slight_smile: