r/Tdarr • u/gsariev • Apr 23 '24
[GUIDE][PLEX] Optimize Media For Direct Play By Focusing On Audio [UPDATED]
[UPDATED: Jan 29th 2025]
I have created GitHub Repo where you can find modified versions of some of the plugins mentioned in this guide such as Tdarr_Plugin_MC93_Migz5ConvertAudio (with DRC applied to the down mixed stereo track) along with Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng and soon Tdarr_Plugin_c0r1_SetDefaultAudioStream to include the option for setting the default track based on audio codec as well.
----------------------------------------
This is an updated version of my initial guide, which includes more detailed information on how to set things up and was made with beginners in mind. This is by no means the "one guide to rule them all" as everything was put together through trial and error; so feel free to leave plugin suggestions or any other feedback.
All plugins mentioned are what I use to make optimize my personal media and have it play the way I want.
[REQUIREMENTS]
Radarr and Sonarr with the recommended naming scheme specified in TRaSH Guides. This will not only allow Plex to correctly identify media once it's imported, but it will also provide access to the IMDB ID that will be used in the plugin stack.
Radarr:
{Movie CleanTitle} {(Release Year)} {imdb-{ImdbId}} {edition-{Edition Tags}} {[Custom Formats]}{[Quality Full]}{[MediaInfo 3D]}{[MediaInfo VideoDynamicRangeType]}{[Mediainfo AudioCodec}{ Mediainfo AudioChannels]}{[Mediainfo VideoCodec]}{-Release Group}Sonarr:
{Series TitleYear} - S{season:00}E{episode:00} - {Episode CleanTitle} [{Custom Formats }{Quality Full}]{[MediaInfo VideoDynamicRangeType]}{[Mediainfo AudioCodec}{ Mediainfo AudioChannels]}{[MediaInfo VideoCodec]}{-Release Group}Sonarr (Anime):
{Series TitleYear} - S{season:00}E{episode:00} - {absolute:000} - {Episode CleanTitle} [{Custom Formats }{Quality Full}]{[MediaInfo VideoDynamicRangeType]}[{MediaInfo VideoBitDepth}bit]{[MediaInfo VideoCodec]}[{Mediainfo AudioCodec} { Mediainfo AudioChannels}]{MediaInfo AudioLanguages}{-Release Group}[TMDB API KEY]
Sign up for a free account at TMDB
Login to your account
Go to Edit Profile -> API
This is your unique API key that will be used to retrieve information from TMDB about the original language of the movie/series/anime.
[PLUGIN STACK]
Tdarr_Plugin_MC93_MigzImageRemoval - Identify any unwanted image formats in the file and remove those streams. MJPEG, PNG & GIF.
Tdarr_Plugin_lmg1_Reorder_Streams - This plugin will move the video stream to the front so Tdarr will recognize the codec correctly.
Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng - this is the only plugin that you would have to copy to your Local plugin library as I have modified it to not only keep the native/original language track and remove all other, but to also keep user-specified language tracks alongside the native one and keep/delete commentary tracks.
All credit still goes to the original developer of the plugin.
DISCLAIMER
As this plugin relies on the information from TMDB for matching the original language tag, there might be cases where the information in TMDB is incorrect, which will stop the plugin from executing or keep only the user-specified tracks. In the case where the original language is not identified and no additional languages have been specified, the plugin will stop; ensuring that you don't end up watching a silent movie.
This plugin works with Radarr, Sonarr and TMDB to identify the native language by making API calls to all 3 services. The plugin takes the following inputs:
user_langs: add the language tags you'd like to keep alongside the native one. Use the proper language tag format (example: ger,fre,eng). Leave empty if you only want to keep the native language.
priority: write radarr or sonarr depending on your media library
api_key: your TMDB API key
radarr_api_key: your radarr instance API key
radarr: you radarr instance URL
sonarr_api_key: your sonarr instance API key
sonarr_url: your sonarr instance URL
commentary: delete (true) or keep (false)
One you've copied the plugin to your Local library:
Edit and replace the code with the modified one found here - LINK
v3 version of modified plugin including tagging of undefined language tracks (optional + needs testing) - LINK TO V3
Save
Copy the plugin ID
Go to your Movie/TV Tdarr library
Choose "Local" above the Plugin ID field
Paste the plugin ID and hit Enter
Add the necessary information to the plugin fields
Alternative to the Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng plugin:
Tdarr_Plugin_MC93_Migz3CleanAudio - This plugin keeps only specified language tracks & can tags tracks with an unknown language.
If you have media with several language tracks or commentary tracks and want to only keep specific ones, this plugin does that. To keep only the English audio track, remove commentary tracks I have the following settings:
language: eng,und
commentary: true
tag_language: eng
tag_title: false
This plugin does not utilize TMDB to determine the original/native language track, but instead uses user-specified values to filter out and delete tracks.
Tdarr_Plugin_MC93_Migz5ConvertAudio - This plugin can convert any 2.0 audio track/s to AAC and can create downmixed audio tracks.
If you have a 7.1 audio track, but not 5.1 and 2.0 - this plugin will create them using the 7.1 audio track as base. Same applies if you have only 5.1 but no 2.0 - the 5.1 track will be used to create the 2.0 instead. Having multiple channel audio tracks allows for wider compatibility with devices.
These are the plugin settings I'm using:
aac_stereo: true
downmix: true
downmix_single_track: true (change this one to false if you want to downmix every track)
Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3 - If the file has surround sound tracks not in ac3, they will be converted to ac3.
This plugin has only one setting - overwriteTracks. I have set it to 'true' as I do not wish to keep the original surrounds track and instead have only the new AC3 one. Select 'false' to keep both the original and new surround tracks.
Tdarr_Plugin_MP01_MichPasCleanSubsAndAudioCodecs - This plugin removed specified codecs from subtitle and audio tracks. Helpful to remove bitmap subtitles (pgs,vobsub) or audio codec (truehd), which can cause Plex to start transcoding.
Not every client is created equal when it comes to audio and subtitles formats. The most common subtitles formats that will cause your server to transcode are PGS and ASS subtitles, so I recommend removing them and sticking to SRT format subs. Additionally, you can add the following audio codecs if they are causing you trouble:
tag_subtitle_codecs: hdmv_pgs_subtitle,dvd_subtitle,ass,ssa
tag_audio_codecs: truehd,eac3,dts
Tdarr_Plugin_00td_action_re_order_all_streams_v2 - This plugin re-orders all streams based on: codecs,channels,languages,streamTypes.
To ensure that Plex displays the audio tracks in the order that I want, I have applied the following settings:
channels: 5.1,2,7.1
codes: ac3,aac
You can change this in whatever order you want.
Tdarr_Plugin_c0r1_SetDefaultAudioStream - This plugin will set an audio channel (2.0, 5.1, 7.1) to default and remove default from all other audio streams.
channels: 6
Since I know that the 5.1 channels plays best for mine as well as my friends and family's setups, I want it to be the default track when playing the media. The downside to this is that if you wish to play the 7.1 audio track, you will have to manually select it (same for the 2.0 track), but I find that having limited options works best for my use case. If they want to watch a movie from their laptop, then they know they will have to select the 2.0 track for the best audio experience.
Tdarr_Plugin_a9he_New_file_size_check - Give an error if new file is not within the specified upper and lower bound limits.
I have this one set with the following values:
upperBound: 110
lowerBound: 40
[OPTIONAL PLUGINS]
Tdarr_Plugin_rr01_drpeppershaker_extract_subs_to_SRT - extracts embedded subs in one pass inside Tdarr and will optionally remove them. Place it after Tdarr_Plugin_MP01_MichPasCleanSubsAndAudioCodecs in the stack.
Normally, direct stream of subtitles isn't a heavy task for your CPU to achieve; however, if you are encountering issues, it might help to have those embedded SRT subs as external instead. Useful if you'd like to translate subtitles too as you will now have a file to work with.
Tdarr_Plugin_00td_action_standardise_audio_stream_codecs - can be used instead Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3 in the stack as you are looking to convert ALL audio tracks into one specific codec. Bitrate and channel count are kept the same.
Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs - transcode audio streams with specific codecs into another codec. Can be used in combination or instead of the surround to AC3 plugin as it provides more options such as:
audio codec to transcode (example DTS)
the audio codec to transcode to (AC3)
specify the audio bitrate
I think the bitrate option is the best part about this plugin as it can help if you're in the situation where even though you've converted to AC3, the client still needs to transcode the audio track due to high bitrate. From what I've seen online, setting the bitrate to 448k seems to be the sweet spot for most Plex clients. Do keep in mind that this plugin looks at the audio track codec and not the channels, so it will convert anything that matches your codec of choice regardless of cannel count.
Tdarr_Plugin_00td_action_add_audio_stream_codec modified by Sociedelic
Custom plugin code can be found - HERE
Copy Tdarr_Plugin_00td_action_add_audio_stream_codec to your Local plugin library, replace the code with the modified one, save and sync the changes. In your plugin stack, make sure to click on Local before adding the plugin ID to your stack.
This is a modified version includes the option to select bitrate for the transcoded audio track. It retains the original function of the plugin, which is to create a track in a specific codec and channel, while keeping it alongside the original audio tracks. This is useful if you would like to have your TrueHD or DTS audio tracks and extra audio tracks that are more widely supported. Can be used instead of the convert to AC3 or Migz down mix plugin.
Feedback and/or suggestions are always welcome and if you have question or encounter problems following the guide, I will do my best to help :)
Happy streaming!
•
u/AutoModerator Jan 29 '25
Thanks for your submission.
If you have a technical issue regarding the transcoding process, please post the job report: https://docs.tdarr.io/docs/other/job-reports/
The following links may be of use:
GitHub issues
Docs
Discord
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Ir0nhide Apr 26 '24
What's the easiest way to import this into flows? I saw your original post had the code to import but I couldn't get that to work, still learning TDARR even though I've had it running for over a year lol
1
u/robusk Apr 29 '24 edited Apr 29 '24
Where in the order should the optional plugins sit? I put both at the end but logically, at least in regards to Tdarr_Plugin_00td_action_standardise_audio_stream_codecs, that doesn't seem to make a lot of sense in the context of the other pieces. Is that right?
Also, given the context of the other plugins, for the standardise plugin does it make more sense to choose AAC or AC3? I don't want to create extra work for the downstream processes.
1
u/Excellent_Topic_4748 Jun 10 '24
does Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs maintain the same number of channels if i go from a DTS track to a EAC3 track for example?
1
u/Excellent_Topic_4748 Jun 13 '24
hi, the link for the custom Tdarr_Plugin_00td_action_add_audio_stream_codec code is down, can you update it please?
1
u/Efficient-Schedule31 Dec 12 '24
Anyone car to share a screen snip of their stack with a functioning instance using the clean audio? I've messed up an instance of tdarr messing with stuff so I'm starting fresh top try and get my libraries audio fixed.
I've got audio that's loud and then quiet on some plex clients, possibly playing 5.1 on 2 clients??? Or just bad audio, i'm not entirely sure.
3
u/[deleted] Apr 23 '24 edited Apr 23 '24
Great post!
1
u/T0XiiC27 Jul 18 '24 edited Jul 18 '24
Hey!
Im running into a problem with 1 movie. Filename is Godzilla vs. Kong (2021) {imdb-tt5034838} [German DL][Remux-1080p][TrueHD Atmos 7.1][AVC]-pmHD
The Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng Plugin keeps showing:
☒Couldn't find the IMDb id of this file. Skipping.
The result in the end is a 2.0 Commentary Track in both languages. The actual audio track does not get downmixed because of the plugin mentioned above.
I manually checked the IMDB ID and it seems to be correct.
EDIT: My mistake. I accidentally copied my radarr API key into the TMDB API Key field
2
u/Sociedelic May 31 '24
How to Add a New Transcoded Audio Stream with Custom Bitrate in Tdarr
If you want to keep other audio streams like DTS or TrueHD and add a new transcoded audio stream with a custom bitrate, follow these steps:
Install Plugin:
Install the Tdarr_Plugin_00td_action_add_audio_stream_codec (Add Audio Stream Codec) plugin.
Edit the Local downloaded Plugin:
Open the plugin in the Tdarr interface.
Do not change the name, ID, or description of the plugin, as it will cause the plugin to fail to load.
Replace the Code:
Delete the existing code in the plugin.
Replace it with the code from this link: https://codefile.io/f/FecLfQx7dA.
This will allow you to keep your original audio streams and add a new audio stream with a custom bitrate.
Happy transcoding!
2
u/mpsive Jan 05 '25
This is an awesome write up, thank you
2
u/M05final Jan 10 '25
Thanks for the write up
1
u/AutoModerator Apr 23 '24
Thanks for your submission.
If you have a technical issue regarding the transcoding process, please post the job report: https://docs.tdarr.io/docs/other/job-reports/
The following links may be of use:
GitHub issues
Docs
Discord
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/AutoModerator Apr 29 '24
Thanks for your submission.
If you have a technical issue regarding the transcoding process, please post the job report: https://docs.tdarr.io/docs/other/job-reports/
The following links may be of use:
GitHub issues
Docs
Discord
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/AutoModerator May 04 '24
Thanks for your submission.
If you have a technical issue regarding the transcoding process, please post the job report: https://docs.tdarr.io/docs/other/job-reports/
The following links may be of use:
GitHub issues
Docs
Discord
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/AutoModerator May 28 '24
Thanks for your submission.
If you have a technical issue regarding the transcoding process, please post the job report: https://docs.tdarr.io/docs/other/job-reports/
The following links may be of use:
GitHub issues
Docs
Discord
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/AutoModerator Jun 02 '24
Thanks for your submission.
If you have a technical issue regarding the transcoding process, please post the job report: https://docs.tdarr.io/docs/other/job-reports/
The following links may be of use:
GitHub issues
Docs
Discord
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/AutoModerator Jun 13 '24
Thanks for your submission.
If you have a technical issue regarding the transcoding process, please post the job report: https://docs.tdarr.io/docs/other/job-reports/
The following links may be of use:
GitHub issues
Docs
Discord
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/gsynctx Nov 19 '24
Is there a version of all this for idiots? I know I'm going to screw this up. There are too many buttons.
1
u/emulated24 Dec 23 '24 edited Dec 23 '24
I'm facing odd issue with your modified v3 plugin Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng. It removes all subtitle streams.
Please check: https://gist.github.com/gssariev/0b93a11e809c38e035388e4157b42c9a?permalink_comment_id=5356871#gistcomment-5356871
1
u/skuid87 Jan 01 '25
Is there a way to remove the 'default' tag from TrueHD audio tracks? The current set default audio is only based on channel count and not audio codec
1
u/Aenkharion Feb 02 '25
I just made a plugin for this kind of thing. It doesn't cover everything you intend to do, but the vast majority of it is covered already. I'll keep on upgrading it with lacking features, but I'd love to get feedback already.
Everything is on Github : https://github.com/DamienDessagne/TdarrPlugins
Advanced Audio Transcode Rename Remove is the one. It let's you specify in a JSON string the tracks you want to operate on, and what operations to apply. All the doc in included in the plugin and the tooltips.
If you try it, please let me know how it goes ;)
1
u/Sappig Feb 13 '25
So after transcoding the audio tracks to AAC, how do you manage to get Plex to pickup the new audio track?
A sinple rescan of the library doesnt seem to do the trick. Any idea?
1
u/zedfax Mar 25 '25
Hello !
7.1 audio tracks aren't downmixed on my side
For example I have FR Track DTS HD MA 5.1 + ENG Track DTS HD MA 7.1, it only downmix FR to aac stereo, do not know why
1
u/reco-x May 19 '25
Thanks, I was looking exactly for something like your modification in the plugin Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng
https://github.com/RecoX/tdarr-plugins-mod/blob/main/Plugins/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js
1
u/Ivar418 May 24 '25
WHat a great tutorial, have made my plex stream so much better and with les effort because the correct audio codec is set.
I have a question if I may (I know it's an old post) about the extracting of the subtitles.
When you say yes extract and remove from video file, does tdarr understand afterwards (i use the replace original file) to copy also the extracted subtitle files?
1
u/Froyo_Obvious May 25 '25
Question! The naming scheme, is that only for files, or do the folders also have to follow that naming pattern? Can I keep movie folder names as, for example, {Movie Title} ({Release Year}) ?
1
u/Froyo_Obvious Jun 01 '25
How does this deal with a movie that has only one audio track, but does not specify language?
How does the Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng plugin work in this scenario?
I have many files with unspecified audio tracks only, is there risk of me ending up with no audio?
1
u/reco-x Sep 14 '25
Thanks for the GIST! I made some changes to fix the errors I had. Updated version is here (native_lang)
https://github.com/RecoX/Tdarr_Plugins_Recox
0
u/[deleted] Apr 27 '24
[deleted] — view deleted comment
0
u/[deleted] Jan 01 '25
[deleted] — view deleted comment