Cayars - Setup walk through and some tips and tricks

It doesn’t magically convert different types of sub files. There are different types of subs, some are text based and some are graphic based.

@cayars said:
It doesn’t magically convert different types of sub files. There are different types of subs, some are text based and some are graphic based.

Man i was sure magic was involved! :stuck_out_tongue:

A pretty impressive system! How do you backup 88 TB of data?

I backup to a couple of online systems. Locally I use SnapRaid with a couple parity drives.

@cayars said:

This is a modified version of sickbeard_mp4_automator with modifications by me. I pulled out all the integration features to make setup much easier.  I also modified it to produce higher quality MP4 files that will direct play better with Plex.

@cayars, this is excellent and thank you for the work. I was more wondering what you changed in the process from the MP4Converter Files to get “better quality MP4’s.” I only ask because using this process with CP/Sonarr is better for me so I think using the MP4Converter in its original state makes more sense but I want to get the better results like your script has that I have been using for awhile. I did some comparisons (beyond compare) to the MP4Converter release but it’s tough to tell only because the MP4Converter is actively worked on so its tough to tell if you removed things or if they are new items. Just curious if there is something beyond the ini or a specific .py file change you did.

Yes I changed a lot of stuff. Overall the MP4Converter doesn’t make use of profiles, levels and doesn’t use constant rate factor properly (or not as I wanted). To put it roughly, mine will generate much cleaner/smaller files while MP4Converter will generate files faster but will not be as good compression wise (larger) and will be more grainy in nature. Due to the beast of not setting up the 264 engine properly.

Mine supports more files types for conversion but I’m not sure this is a big deal. For example I’ll convert MPG or Flash where MP4Converter doesn’t (or didn’t) do this.

I also do other things such as generate a 2 channel AAC audio track and make sure it’s the first track. There is some support for this in MP4Converter but it’s still buggy. I also clear all meta data from the file when generated otherwise Plex likes to read and use this which gets you funky headings on titles.

I also generated the MP4 MOV ATOM differently which seems to work better.

That pretty much covers most of the major things off the top of my head. I might release a new version of this soon with additional features to overide some functions and do a few things differently.

@cayars said:
Yes I changed a lot of stuff. Overall the MP4Converter doesn’t make use of profiles, levels and doesn’t use constant rate factor properly (or not as I wanted). To put it roughly, mine will generate much cleaner/smaller files while MP4Converter will generate files faster but will not be as good compression wise (larger) and will be more grainy in nature. Due to the beast of not setting up the 264 engine properly.

Mine supports more files types for conversion but I’m not sure this is a big deal. For example I’ll convert MPG or Flash where MP4Converter doesn’t (or didn’t) do this.

I also do other things such as generate a 2 channel AAC audio track and make sure it’s the first track. There is some support for this in MP4Converter but it’s still buggy. I also clear all meta data from the file when generated otherwise Plex likes to read and use this which gets you funky headings on titles.

I also generated the MP4 MOV ATOM differently which seems to work better.

That pretty much covers most of the major things off the top of my head. I might release a new version of this soon with additional features to overide some functions and do a few things differently.

I think the “big” thing missing for someone like me is being able to read sub-folders, so for example I point it to:

\hades\movies and it goes and grabs \hades\movies he descent he decent.mkv (but not the descent-trailer.mkv) and replaces it with the mp4 version. Right now I have been using it but with 1700 movies its a long slow process to move each file one at a time to process :slight_smile: That is why I figured having it sit in the original intended spot (after CP/Sonarr) would be good since it would automate it better for me.

It works with sub directories at present. Try it. :slight_smile:

However, it will process all files including the trailer. Why would you not want it to process the trailer? If you aren’t going to use it don’t download it.

@cayars said:
It works with sub directories at present. Try it. :slight_smile:

However, it will process all files including the trailer. Why would you not want it to process the trailer? If you aren’t going to use it don’t download it.

Fancy, I didn’t know that, so if I wanted it to go through my entire library I would point it to my network share and it would go through. I assume I would want the output folder the same location so that it will place it back into the same folder as the original?

So for my instance:
the run.bat would be: c:\python27\python manual.py -a -i \\HADES\Movies
and the autoProcess.ini would be: output_directory = \\HADES\Movies

That would then turn for example this:
\\hades\movies\Contracted Phase II (2015)\Contracted Phase II (2015).mkv
into this:
\\hades\movies\Contracted Phase II (2015)\Contracted Phase II (2015).mp4

Also, I can convert the trailers, as I use them, I just figured they aren’t important and I don’t really care if plex transcodes a 40mb trailer so why waste the converters time.

My Wish list for 2016

@don.alcombright said:
Fancy, I didn’t know that, so if I wanted it to go through my entire library I would point it to my network share and it would go through. I assume I would want the output folder the same location so that it will place it back into the same folder as the original?

First of all, setup a test environment. Maybe grab 10 directories and copy them to a different area to test with in case something goes wrong.

If you want the files written to the same location they started in you can edit the INI file and remove the output directory. Just erase anything after the equal sign.

The downside to this is that if you don’t process your whole directory structure in one shot and need to restart you won’t ever know where you left off!

Another way (I’d recommend) is to start using the scripts on all files before adding them to Plex. I can show you how to read to create a set of scripts that will pull info from the plex database to know what’s not optimal and this way you can batch process them. This is probably better then the first option as you can restart it at will.

Carlo

I use the mp4 automator script heavily for both Sonarr and Couchpotato…How easy is it to incorporate your changes into the script? Also, the script you mention above for non optimal files sounds great :slight_smile:

I have CP and Sonarr drop the files needing conversion into the process folder, and then Sonarr watches the done folder for episodes. For CP I haven’t quite got tha working with automation yet, and as I have different types of movies in different libraries not sure I want to mess with that for right now.

Sonarr picks up the converted file, renames it and move it to the directory I have my library pointed to. It does this automatically, hands free.

My scripts are modified from @cayars scripts but only to make them work within the OS I run my PMS on. Otherwise they are as plain Jane as he has them in his original post…

@cayars said:

@don.alcombright said:
Fancy, I didn’t know that, so if I wanted it to go through my entire library I would point it to my network share and it would go through. I assume I would want the output folder the same location so that it will place it back into the same folder as the original?

First of all, setup a test environment. Maybe grab 10 directories and copy them to a different area to test with in case something goes wrong.

If you want the files written to the same location they started in you can edit the INI file and remove the output directory. Just erase anything after the equal sign.

The downside to this is that if you don’t process your whole directory structure in one shot and need to restart you won’t ever know where you left off!

Another way (I’d recommend) is to start using the scripts on all files before adding them to Plex. I can show you how to read to create a set of scripts that will pull info from the plex database to know what’s not optimal and this way you can batch process them. This is probably better then the first option as you can restart it at will.

Carlo

Of course on the test environment, I ain’t that crazy. :slight_smile:

So this process will still take mp4’s and try to re-convert them every time, maybe I am not reading that right? I assumed it would just skip over those. My thought was to not overwrite while I convert my current library and to just run at night, and in the AM see what was converted and manually go in and delete the mkv (I suppose to make this easier on myself I could just keep a “done” folder since I am manually doing stuff anyways. If the process fails it shouldn’t matter since I didn’t delete the original, however if on restart the script keeps trying to do the .mp4 file that were already done that would be a problem.

I am definitely interested in the script, that is for sure, because getting new movies through this process would be great, but I definitely need to fix my current library as it stands. Keep in mind, I am running Plex from my unRAID NAS, but I am ok with this script/process working off my Windows 10 box, so, making it work for linux doesn’t matter as long as it can see network paths fine :slight_smile:

@don.alcombright there is a INI setting that you can use to tell it to reprocess MP4 files or not.

If you set this then of course you could start where you left off and process any MkV, AVI, etc files.

The only downside to this is you have no idea what’s in the MP4s. Are they MPEG4 or h.264 encoded video? Do they have AAC 2 channel as the first track? Are they using a 4.1 or 5.0 level that some of your clients don’t use? Do any of your MP4 use 10 bit color space. <-- All these questions are why it “can” be a good idea to walk your whole library the first time OR just process everything not MP4 as they will need it and then revert to plan B which is to query the database looking for files:
not “web optimized”
not 4.0 level
not 8 bit color space
wrong number of reference frames
etc

Go ahead and setup and start testing the convertions of all non MP4s and when you get that done come back and ask about the database query/automation to re-process these other “problem” files.

Carlo

Carlo,

Could this same idea of the database query/automation method be used to also generate lower bitrate versions with these conversion scripts? Like have a method to check for multiple versions of the media, and if not, read in the bitrates, and then generate the 4Mbps and 1.5Mbps versions from the existing media?

Just a thought, you know how I get those from time to time. Usually if I sit on them a while, they naturally just dissipate, but I’ve had this one floating around for a while now… :slight_smile:

Yep sure can. :slight_smile:

You guys need to wait for version “2”.

Many things have bugged me about the scripts. For example it will remux if it can keep the h.264 video but there is no override to force a transcode if the h.264 video is 10 bit, is using a level higher than 4.0, is not optimized, has to many ref frames, etc.

I haven’t started working on these issues yet to be honest. I’ve just been thinking about them. I could modify the scripts I already provided or could start from scratch and do them much better/easier. I’m debating how I want to proceed.

Right now the easiest approach I’m using is the standard scripts combined with a database lookup to process these types of files seperately.

My natural thought is to go C# but that may not be good for the masses although anyone on windows or Linux with the ability to run C# would like the outcome. I’ve been playing with a custom version of something similar to what I provided but it can use multiple computers (distributed) and can make use of single cores if you want. ← Single core transcode is always better than spreading the load out to several cores. It’s way slower but the results are better. So if you have an 8 core machine you could run 8 transcodes at the same time but each would only use 1 core. It wouldn’t use hyper-v cores as they are “fake cores”.

As I play more I’ll probably make a decision how I want to proceed with the scripts. I’m also keeping an eye on what Plex does with Media Optimizer.

Wow.
Sorry, I skipped ahead after reading the main/original post on the converting scripts.
So my questions:
*When you say all that’s needed is Python 2.7, does that mean these scripts will all run in any environment? So could I run this locally on my Linux-based NAS (Synology)? Not sure I even want to (yet) but am curious.
*Does this take advantage of Quicksync encoding acceleration? If so then it becomes a tough choice of where to run it. QS encodes using handbrake on my W10/i7 desktop are very fast, but if I have to move TB’s of video files to that machine for transcoding, then move them all back to the NAS afterwards, it kinda defeats the benefit of the Quicksync speed; may as well let the NAS do it slowly/locally.
*Why MP4? I like the mkv container. Not sure why MP4 is so popular.
*Why strip out subtitles? I don’t use them much, but usually rip my blu rays with them (to mkv using makemkv) so they are there if guests want them.

My library is not nearly as large as some peoples on this forum, but there are several movies I’d like to encode or re-encode that I haven’t got to, so this may be a good solution for me.

Thanks…

@kieranc said:
Wow.
Sorry, I skipped ahead after reading the main/original post on the converting scripts.
So my questions:
*When you say all that’s needed is Python 2.7, does that mean these scripts will all run in any environment? So could I run this locally on my Linux-based NAS (Synology)? Not sure I even want to (yet) but am curious.
*Why MP4? I like the mkv container. Not sure why MP4 is so popular.
*Why strip out subtitles? I don’t use them much, but usually rip my blu rays with them (to mkv using makemkv) so they are there if guests want them.

Thanks…

If you look here you will see the editing I did to make these scripts run on an Asustor NAS:

https://forums.plex.tv/discussion/165352/auto-transcoding-scripts#latest

Quite literally all I had to do was install Python 2.7 (which was already installed.) Download ffmpeg for the OS type and CPU build and edit the scripts to make these work. I can give you an ftp to download them if you PM me an email address…

MP4, H264, AAC stereo are the best container/codec for Direct Playing on Plex based Clients. These codecs and container will usually Direct Play, unless you do something like request lower bitrates, add in un-supported subtitles, etc.

More info here:

https://support.plex.tv/hc/en-us/articles/204377253-What-media-formats-are-supported-

The very reasons you like MKV are the same reasons it’s not a good container for streaming media. MP4 works if the client requests the same bitrate or higher than the media is stored, with a lot less wear and tear on your hardware.

@cayars, I think I am ready to see about how to find out if something should be converted or not, although I anticipate about 95% are mkv’s in my library.

I have been thinking of an automated but manual method to this madness, and I am missing a few pieces to the puzzle and might be ready.

My thoughts where to batch this process out the cleanest way for me to monitor, meaning I would get a list somehow (through your db query hopefully). I would then just batch out that process and put counters in the batch process. This means I can do an individual conversion for each folder and can also make it so it only runs on X number of movies at a time allowing me to check my work as I go. I assume I just need a query that returns the file locations of the movies I should convert. I know Plex stores the file location, I just don’t know how to tell if a file should or should not be run through the conversion process.

My other question, your autosettings has relocate_moov = False. Is this an error or did you use some other method to do this? If this should be true let me know at your earliest convenience as I have converted about 50 films already :slight_smile:

Since running this across my network is also adding about a 10x multiplier I think I will also XCOPY to Windows then XCOPY back to unRAID to save time. Please if you have better thoughts on ALL the above let me know!