Cayars - Setup walk through and some tips and tricks

Hi,
Using the 2.2 Script to convert all my MKV Files
Works as it should - thank you for that
But is there any Reason why ffmpeg.exe only uses 1 CPU Core?
Using it for h264 Codecs and it “only” copies, so no Transcoding

Unless you change the core setting it will be set to auto which will use as many cores as it can depending on the codec it has to convert from. Some codecs are single core only.

If the source is already H.264 and fits the parameters set in the ini it will probably only rewrite a new audio track and just remux the video (which is all it should do). Those files should be much quicker to process.

First off, I wanted to say thank you for this script. It truly works amazing. It took a bit to get it working but after reading through the forum and such I managed in the end.

However I was wondering if it’s possible to make it encode to H.265 instead of H.264?
Reading autoProcess.ini it seems that I should only change “video-codec = h264,x264” to h265,x265 instead?

Is all of your media in H.264 because not very many clients can direct play H.265?

@cayars
I apologize if this has been asked and answered. I got through about 20 pages of this thread, and went through your code (I don’t understand python, so looking at your code was a bit confusing), and still haven’t found the answer I’m looking for…

My PMS setup has done me well for the last couple of years. However, since opening it up to family and select friends, I’ve had to make adjustments (I don’t add 1080 content, everything is 720 or less) to ensure there is minimal transcoding down.

Currently, Lucy (specs in sig) is my converter. I use flexget & transmission, then each file is processed through PlexTV.pl (my own creation) with the following 2-pass ffmpeg code:

$passone = 'ffmpeg -i $inputone -c:v libx264 -level:v 3.1 -b:v 1000k -minrate 800k -maxrate 1000k -bufsize 1835k -c:a aac -strict -2 $outputone';
$passtwo = 'ffmpeg -i $outputone -c:a copy -c:v copy -movflags faststart $outputfinal';

The problems I have run into with this code are:

  • I have a lot of content that is 1080 I would like to convert down to 720 but when I used -vf scale=-1:720 in the code, it tries to scale up files that are smaller than 720 which I don’t necessarily want to do (pan & scan Perry Mason does not look right at 720, LOL)
  • Some of my family & friends have devices that don’t support 5.1/7.1 audio so I am still seeing transcoding happen

Looking at your code from Convert-2.2.zip it seems (correct me if I am wrong) your code will not only downscale content from 1080 to 720 but also keep the 5.1 audio track and make a stereo track as well using ios-audio = True ?

Again, I apologize if this has been asked and answered … I don’t need the majority of your code since I am running Ubuntu and am pretty content with flexget & transmission … but how (or in which of your files can I find the answer) can I achieve the desired audio results with ffmpeg?

Yes, that is correct. It can downscale (not upscale), keep any tracks you want as well as add 2 channel stereo track as the default. It can also deinterlace if needed which is handy when you use the DVR function. It also does a lot of other things to make sure the files are compatible. It’s smart enough to remux when it can vs full transcodes.

I’d seriously ask you to re-think about converting from 1080 to 720 as this is mostly pointless. You are just “destoying” the quality of the picture. Later when you upgrade to a large TV or 4K TV you will be kicking yourself for destroying the resolution you had.

You should not find problems playing back 1080p content on any devices. 1080i may look bad if the client can’t deinterlace however which is shy you want to deinterlace it during conversion if needed.

I totally agree. I would much rather have everything at 1080. The problem I have run into is my friends & family. Some of them either use devices that don’t play 1080 natively (xbox 360/older Android devices) or their Internet connection is such that 1080 ends up getting transcoded.

Can you point me in the right direction to where in your Convert-2.2.zip I can find both the downscale and dual audio switches for ffmpeg?

Updated: I went ahead and tried it. Everything is still as described below. Thanks for the great info. SO MUCH better than the stock agents/settings. My wife can finally see her work out videos and not ask me why we don’t have a DVD player :slight_smile:

Thank you for the great trips and documentation. Is this the most up to date method to add no movie videos? It looks like it was last updated in 2015. IS everything still applicable as far you know? I’m converting from Kodi. I have a about 20 ISOs that I need to deal with. They are exercise videos, interactive school DVDs, etc. I ripped them all as ISO because the menu was actually needed. Thanks for all the tips!!!


After struggling for some time to try and organize NON movies or TV Shows I finally found a way to pretty easily organize some “personal” media".
NFL LIBRARY
NFLpng

NFL2png
NFL3png

LEARNING LIBRARY
Learning1png
Learning2png
Learning3png

SUMMARY
My choice of icons on this last set of images is only temporary and I’ll soon be replacing them with some icons I’ll make specifically for Plex. I just added them to grab some screen shots. This “Learning” library is still a work in progress and I only have about 25% of my DVDs ripped and uploaded. Just started it yesterday.

This way of organizing a library has made it easy to find media. This is especially helpful on the xBox One as there is no search feature. Trying to find an NFL game from last week WAS BLOODY HELL but now it’s a piece of cake.

I know many people struggle with trying to make sense of putting their personal media up in Plex in a way that makes sense to navigate and I think these two different libraries show that this can be accomplished. I’ll be using this technique with a couple of other libraries such as personal family videos, other sports libraries, etc…

HOW TO DO THIS
The “Secret Sauce” to this setup is three things:

  1. Addition of a new Scanner
  2. Addition of a new Meta Agent
  3. Naming your files properly so they “fit” a category in your new library.

Extended Personal Media Scanner
Go to the following thread and download the Extended Personal Media Scanner here: https://forums.plex.tv/topic/88982-rel-extended-personal-media-scanner/
The installation directions may be a bit “off” so this is what you want to do. Follow the instructions give to navigate to the “Scanners” folder. Only don’t put the contents of the zip here yet.
Create a sub-folder under Scanners called “Series” without the quotes. Now find the .PY file in the zip and put this file in the Series folder. You should end up with something like the following:
C:\Users\cayars\AppData\Local\Plex Media Server\Scanners\Series\Extended Personal Media Scanner.py

Extended Personal Media Shows Agent
Go to the following thread and download the Extended Personal Media Shows Agent here: https://forums.plex.tv/discussion/83440/rel-extended-personal-media-shows-agent
Follow the instructions exactly as posted in the first message so you end up with something like the following:
C:\Users\cayars\AppData\Local\Plex Media Server\Plug-ins\ExtendedPersonalMedia-Agent.bundle ← this folder/directory will now have both “Contents” and “Resources” in it.

You may want to stop/start Plex server at this point if the next section doesn’t work.

FILE NAMING
You will see the scanner/meta-agent can take various formats of naming and be able to work with them. I’ve found the S2014E01 format to work the best for me especially with sports. If I used date based formats (2014-01-20) then I get results I may not want. For example while the Super Bowl this year will be played in 2015 I don’t want this game or the playoff, etc listed under the year 2015. I want them to be with the rest of the 2014 season. This of course is a personal preference. The date based naming style cold be super using with family movies. Just use the style that works for the library at hand.

I’ll share some file names:
2012 Week 1 NFL
Week 01 - S2012E01 - 49ers at Packers.mp4
Week 01 - S2012E02 - Bengals at Raven.mp4
Week 01 - S2012E03 - Bills at Jets.mp4

2013 Super Bowl
Super Bowl - S2013E01 - Broncos at Seahawks.mp4

2014 Week 15
Week 15 - S2014E01 - Bengals at Browns.mp4
Week 15 - S2014E01 - Broncos at Chargers.mp4
Week 15 - S2014E02 - Cardinals at Rams.mp4

So the format is “category” - “year/episode” - “file name”. Make sure each file has a different episode number.

For my Learning library:
Educator Math - S04E01 - Expressions and Formulas.mp4
Here I’m not using date in the series but just a series number. Course one will be season 01, course two will be season 02, etc.

ADDING A NEW LIBRARY
You add a new library as normal EXCEPT you start by adding a “TV SHOWS” library. Add your folder(s) as normal and then click on “Advanced”
Here you will choose both a different SCANNER and a different AGENT like so (The two we just installed):
Add_Librarypng
Have fun and let me know how this works out for you!

Carlo

@cayars a while back I had heard that embedded subtitles are better than external srt subs in terms of not causing transcoding.

I setup your convert scripts to embed subs which works just fine. I have seen at times when I load the subs it transcodes but other times no. My question is are embedded subs better than external srts? If srts are better any suggestions on how I could covert my existing already convert library to strip out the embedded subs and download srts instead?

I think you might have that backwards. I remove/pull the subs from the file and keep them separate.

This way they are never loaded if not needed (lower bandwidth) and make transcoding simpler/faster since there are less tracks to process.

You should be able to adjust the ini file to create external subs, then just re-run these files through the script again. It will pull the subs and remux the audio/video so there is no quality loss.

@cayars can I get a copy of your script? the link from the thread are old and doesn’t work. thank you so much.

edited: nvm I found it on post 1011.
Thanks

Thanks, I’ll work on getting those embedded subs stripped out. I already have the MOOV atom located at the start of file. Can I just set relocate_moov to false or will this recode to strip out the subs move the previously relocate MOOV atom? Thanks!

Hi, Carlo (@cayars).

I’m wondering if your scripts need anything special in order to handle 4K content? Or is that completely dependent on the underlying utilities that are installed to do the work?

I guess the question I’d ask is what are you trying to accomplish with the 4K files?
Trying to downgrade them to 1080?
Copy the video while adding 2 channel audio?

Tell us what you are trying to do.

I would like to be able to optimize them like I do the 1080 files - reduce file size while maintaining high quality PQ (may not be as possible with 4K as it is with 1080, don’t know), reorder bits (relocate MOV atom), properly configure the forced subs, add a two channel audio track, and possibly even generate a downscaled version for non-4K devices.

It should do this out of the box already. You just need to check the setting in the ini file to make sure you aren’t constraining the output size to 1080.

Hi,
Love your Version of the Script.
But is it possible to clean up the Script to use it just for Subtitle ripping (dont download) and Conversion is h264 lvl is to high and no AAC Audio is in there?
Dont need all of the other things
a Powershell Version of this would be even the best thing :wink:

Will it convert h264 to h265 for 4k content?

It can do all those things. You just need to set the options in the INI file appropriate to what you want it to do.

What do you mean from H.264 to H.265 for 4K content?
The great majority of 4K content you will find is already in H.265 as 265 is almost always used for 10 bit content.

AS IS the script will not function backward (265 to 264) with tone mapping. I was thinking of adding this but I’m not sure how useful it would be.

Personally, I’ve changed from universally using MP4/H.264 to MKV/H.265 these days. If I record anything that is already in H.264 I’ll keep it that way. If I record anything that’s mpeg2 instead of converting to H.264 I’ll now convert to H.265 instead for better compression. I’m using nothing but 10 bit for these as well.

EVERY device I now use can play back H.265 so this is fine for me.

I have content that I captured on my Mac that is encoded with H.264. The resolution is technically 4K, and H.265 would be more appropriate, but that’s not the default encoding that was used at capture time by QuickTime.

I’m wondering if running this content throught the scripts would change the CODEC to H.265 since it would seem it’s more appropriate.