Disallowing 4K Transcoding in Plex using Tautulli

killstream.py (KSPY)

killstream.py is a robust, small Python script written by blacktwin and part of the JBOPS repository. The primary purpose of KSPY is to do just that, kill a stream. KSPY can be triggered using boolean logic in Tautulli, very simply, to end streams transcoding video at resolutions we don’t want, say 4K.


  • Working installation of Plex
  • Tautulli installed and running and integrated with Plex
  • Copy downloaded of killstream.py that is accessible (read permission) by Tautulli. In my case, I added a docker path to a scripts folder and placed the file there.
For this tutorial, we will walk through setting up KSPY to end any stream trying to transcode a video greater than a certain bitrate, and notify the streaming user. I have my conditions set to limit a stream if both the video resolution is greater than a threshold and the video is transcoding. You can adjust this number to whatever you wish, and add other conditions.

Steps (in pictures)

Add a new notification:


In the script settings, under Script Folder specify the path to your killstream.py. The Script File is a dropdown that will populate with all valid files Tautulli can run for you from that directory:


Select your triggers. I went with Playback Start and Playback Resume. The Script will be run on these events:

I then created two conditions. No need to fill out your Condition Logic if you’re doing something where you want all of the conditioned to be anded together; that’s the default behavior:

For each of the Trigger events you had selected earlier (in my case Playback Start and Playback Resume), pass in the KSPY arguments you want. I’m going to kill the stream with the same message — see below:

--jbop stream --username {username} --sessionId {session_id} --killMessage 'Transcoding streams are not allowed for 4K content (Yours: {stream_bitrate}). Contact the Plex admin for help.'

{username} is your server username. The rest should be self explanatory. Modify to your liking:

Save & You’re done

Pro Tip: You can set up a similar rule to prevent transcoding of Standard Definition (SD) if you want. This may be helpful if you want to encourage direct-play only setups or keep people in a bandwidth range you prefer. For example, I have another rule setup to prevent <4mbps as everyone who is on my system can do higher but sometimes they get a new client like a Fire Stick and forget to change the settings.

Want to discuss this post? Head on over to our forums!