Cayars - Setup walk through and some tips and tricks

@Coxeroni said:
Honestly I didn’t look what the scripts are doing in detail, but for me it works perfectly when I just call it by Sabnzbd. Afterwards either Sickrage or cuchpotato is called and does the renaming and moving. I don’t tag so I am not missing anything.

Yes. Like I said, this is totally acceptable. I was just explaining how the scripts were designed for.

@cayars

I re-did all my media files with the new script and used MediaInfo to confirm that the AAC Stereo audio codec is already set to Default. But my Roku Media Player still plays the 6-channel AC3 codec by default. Any ideas?

@kevindd992002 said:
@cayars

I re-did all my media files with the new script and used MediaInfo to confirm that the AAC Stereo audio codec is already set to Default. But my Roku Media Player still plays the 6-channel AC3 codec by default. Any ideas?

Same for me on my OpenPHT embedded, and I love it :smiley: the reason is I was afraid I would be stuck with default stereo while my Chromebox can obviously handle all kinds of audio. But violà: the much better 5.1 audio track is selected per default. Marvelous :slight_smile:

@cayars I’m trying this for the first time and I have a question. I tried converting a file that had ass subtitles included in an mkv file. After the conversion, the subtitles were extracted to srt files as expected. But when I played the video, the subtitle fonts were different (removed?) and the positioning of the subtitles were wrong (the original video had them specifically placed and the new version had them at the bottom of the video). I tried playing the video in VLC Player to test it out.

Is it not possible to copy over the fonts/positioning to new mp4/srt files, or am I doing something wrong?

@Coxeroni said:

@kevindd992002 said:
@cayars

I re-did all my media files with the new script and used MediaInfo to confirm that the AAC Stereo audio codec is already set to Default. But my Roku Media Player still plays the 6-channel AC3 codec by default. Any ideas?

Same for me on my OpenPHT embedded, and I love it :smiley: the reason is I was afraid I would be stuck with default stereo while my Chromebox can obviously handle all kinds of audio. But violà: the much better 5.1 audio track is selected per default. Marvelous :slight_smile:

I think it’s because Plex detects that my Receiver is multi-channel capable. The thing is that my TV is just Stereo.

EDIT: Got it to work. I set the Global Audio settings on my Roku to Stereo and the Plex app followed suite. It’s funny that I resolved almost all of the issues that I posted here, lol.

@cayars I tested your convert script against one of my media files. Upon completion, I see the following for audio within plex for the converted movie:

English DTS 5.1
English AC3 stereo
English AC3 stereo
English AC3 stereo

I see the following for subtitles within plex:
English - MOV_TEXT
Espanol - MOV_TEXT
English - MOV_TEXT
Espanol - MOV_TEXT

I was expecting DTS 5.1 and 1 AC3 Stereo for audio and just two subs (one for English and the other for Spanish). Any idea what I did wrong and how I could accomplish this? Thanks in advance.

Is there an easy way to probe existing files to get their resolution? I’ve tried doing this with ffmpeg and ffprobe, but it doesn’t appear that I can correctly pass the resulting output via pipe to grep / cut. In a nutshell, I want to be able to ‘walk’ my library to find all M4V’s that are 1080p and don’t have a corresponding 720p version already on disk as well as all MKV’s that are 1080p and I want to pass all of them through my own “control script” to transcode them over to M4V’s and/or create 720p versions of the content sit next to the 1080p versions (for remote viewing).

It’s probably going to be much harder than you think as not all your videos will be 720 or 1080 specifically but close. So you might need to check ranges of resolutions.

ffmpeg is writing that information to stderr, not stdout
I believe ffprobe is similar.

ffprobe -v quiet -print_format json -show_format -show_streams “file name” will get you the information you need for sizes as well as other useful info you might want down the road.
The lines to grep for would be something like the following:
“width”: 352,
“height”: 240,

Since ffmpeg uses stderr you can always use >
ffmpeg option > results.txt ! grep options

See if that helps,
Carlo

How does Plex get this information and show the video resolution as 480p, 720, 1080p, etc.? If you pull up the “Get Info” details on a piece of media, the upper left portion has this shown in the more basic numbers.

@seanblue10 said:
@cayars I’m trying this for the first time and I have a question. I tried converting a file that had ass subtitles included in an mkv file. After the conversion, the subtitles were extracted to srt files as expected. But when I played the video, the subtitle fonts were different (removed?) and the positioning of the subtitles were wrong (the original video had them specifically placed and the new version had them at the bottom of the video). I tried playing the video in VLC Player to test it out.

Is it not possible to copy over the fonts/positioning to new mp4/srt files, or am I doing something wrong?

So to break it down…

What is a SRT file?
SRT, or SubRip text, is the most basic and simple format for subtitles which is widely used for videos. Usually, an SRT file mainly contains the number of the subtitle in the sequence, the start and end times of when the subtitle appears, the subtitle content and a blank line to indicate the start of next subtitle. SRT does not include any video data. It is just a text file which allows you to create or edit by using any text editor at will.

What is a SSA file?
The .ssa file extension is commonly associated with Sub Station Alpha freeware application which is specialize in creating SSA subtitles for video files. It allows you to add more special display effects such as positioning, karaoke and style managements than the conventional SRT and similar subtitles. SSA subtitles are saved in text format but complex than SRT.

What is an ASS file?
ASS stands for Advanced SubStation Alpha, which include all the features of SSA and expand more effects on the basis of SSA. These ASS subtitles are also created by SubStation Alpha software program. The ASS subtitles allows for formatting and styling of subtitle text and is popular among Anime and Karaoke projects.

So basically the .ass file has formatting support, and the .srt is only a text file and doesn’t have formatting support.

@ember1205 said:
Is there an easy way to probe existing files to get their resolution? I’ve tried doing this with ffmpeg and ffprobe, but it doesn’t appear that I can correctly pass the resulting output via pipe to grep / cut. In a nutshell, I want to be able to ‘walk’ my library to find all M4V’s that are 1080p and don’t have a corresponding 720p version already on disk as well as all MKV’s that are 1080p and I want to pass all of them through my own “control script” to transcode them over to M4V’s and/or create 720p versions of the content sit next to the 1080p versions (for remote viewing).

I would rethink doing this. Plex works differently now then it did a year ago and the ability to “Optimize” files offline for Plex use isn’t worth it anymore. Plex has new ABR functionality that will dynamically transcode files on the fly and adapt the bitrate to make the best use of the pip between the server and the client. So you’re 720 versions won’t get used nearly as much as you think they will.

At present any time Plex needs to transcode it falls back to using the original file which is the first one added or in your case will be the 1080 version (hopefully de-interlaced).

With modern Plex you are probably better off letting it manage the transcodes and if needed add a GPU to your server to help offload some of the transcodes.

Carlo

Is there any way for me to keep the bookmark I have for this thread but turn OFF notifications? I can’t figure out how to do that.

Thanks!

I got a question about this post:

In there it says:

"Performance Tweaking
under Convert\Converter\ffmpeg.py change to the following:

cmds.extend(['-crf', '18'])
cmds.extend(['-threads', '1'])
this will increase the quality and also only allow it to run on one core per process, again helping with quality."

Here what is in the ffmpeg.py file as it relates to cmds.extend:

if preopts:
cmds.extend(preopts)
cmds.extend([’-i’, infile])

    # Move additional inputs to the front of the line
    for ind, command in enumerate(opts):
        if command == '-i':
            cmds.extend(['-i', opts[ind + 1]])
            del opts[ind]
            del opts[ind]

    cmds.extend(opts)
    if postopts:
        cmds.extend(postopts)
    cmds.extend(['-y', outfile])

Where do I add and/or change this section to include the above performance tweaks? Thanks in advance.

@cayars

How do you specifically do what you said above: “With modern Plex you are probably better off letting it manage the transcodes and if needed add a GPU to your server to help offload some of the transcodes.”?

Is there a setting in PMS wherein you force the server to do the transcoding instead of the Plex Client?

@cayars activated Drivepool with Snapraid on my Server - works like a Charm.
But for some of my Files created by PMS Plugins (Subtitles by Subzero) Drivepool puts These Files on new Folders on Drives it shouldnt.
Autobalance is deactivated. Any Idea why this happens?

If you are referring to getting a folder such as “Top Gun (1986)” on drive D: and the same folder on drive E: both with different files in it (not duped) then yes that can happen. It usually writes to the drive with the most free space.

I learned to handle this a long time ago by keeping one drive with clearly more space available on it so anything written to the pool uses that drive. I NEVER write to the pool myself but Plex/Emby or some plug may.

I simply look once a week/day/month (whatever) at that one drive that things will write to and move the contents to the proper drive.

I have my drives set such as D will have movies A-C, drive E will have D-G, etc… So it’s easy for me to know where to move files.

But in any case if you only look at the POOLED drive and look at “Top Gun (1986)” it will show you all files that are part of that directory even if they are spread out on 10 discs. So it works just fine even it it’s not exactly what/how you think it will work.

It’s an OK trade-off once you learn how to manage it.

Carlo

@cayars said:
If you are referring to getting a folder such as “Top Gun (1986)” on drive D: and the same folder on drive E: both with different files in it (not duped) then yes that can happen. It usually writes to the drive with the most free space.

I learned to handle this a long time ago by keeping one drive with clearly more space available on it so anything written to the pool uses that drive. I NEVER write to the pool myself but Plex/Emby or some plug may.

I simply look once a week/day/month (whatever) at that one drive that things will write to and move the contents to the proper drive.

I have my drives set such as D will have movies A-C, drive E will have D-G, etc… So it’s easy for me to know where to move files.

But in any case if you only look at the POOLED drive and look at “Top Gun (1986)” it will show you all files that are part of that directory even if they are spread out on 10 discs. So it works just fine even it it’s not exactly what/how you think it will work.

It’s an OK trade-off once you learn how to manage it.

Carlo

Yes - only files created by Plex or Plugins.
Ok - so I will just cleanup them from time to time - thanks.

@cayars my understanding is that your latest scripts move the ATOM a different way and therefore does not require that “relocate_moov = False” be changed in the autoprocess.ini file. I ran my media through the scripts and later used the procedure you documented to query the Plex DB to find MP4 files that are not web optimized. The generated output produced the same files that had previously been successfully converted by your script. The select statement I am using is:

SELECT ‘c:\python27\Python C:\Scripts\manual.py -a -i "’ || file || ‘"’ FROM media_parts join media_items
on media_parts.media_item_id=media_items.id
where container=‘mp4’ and optimized_for_streaming <> 1 and library_section_id=‘1’ or library_section_id=‘2’

Does the fact that you move the ATOM in a different way render the above statement useless? If so, is there another way (different field perhaps?) that we could query to determine if the MP4 is or is not web optimized? Thanks in advance!

I would think that script is fine but didn’t look/test it.

Yes the script uses an external program to change the move atom vs using ffmpeg for a couple of reason which could be as simple as the file already had proper audio and video codecs but just not web optimized.

Here is what I would ask. View a specific movie/show that was just processed. Bring up the view info on it and see if it says web optimized or not in there. If not analyze the file and look again.

Thanks for the response. I did as you asked and picked a media file that had already been ran through the scripts and it says “no” for web optimized in getinfo via the plex GUI. After running it through the script again and having plex analyze the media it still shows no for the media. Do you think I should run the file again through the scripts but this time change the relocate_moov to true? Not sure what impact that would have given that you move the atom file via other methods. Thanks in advance.