Cayars - Setup walk through and some tips and tricks

Got into safe mode, and discovered a program I thought I had deleted was still on computer. It was randomly calling for ffmpeg to begin. Found it by running task manager and doing about 15 trials with just a 5 minute segment like @cayars had suggested.
Thanks to all for going through this with me, and all your suggestions and help

I have a quick question that hopefully the community will be able to help me with. The scripts have work flawlessly for me for quite some time. I noticed that occasionally I got a HEVC file that when run through the process would fail. The autoprocess.ini file is using these pertinent settings:

video-codec = h264,x264
video-bitrate =
video-max-width =
h264-max-level = 4.0

I got the script and able to get the HEVC file to properly convert with these settings:

video-codec = h265,x265
video-bitrate =
video-max-width =
h264-max-level = 4.1

I use the original script in conjunction with Sonarr/Radarr. My question is can I add the values from my second autoprocess.ini file into my original autoprocess.ini file so it will look like so:

video-codec = h264,x264,h265,x265
video-bitrate =
video-max-width =
h264-max-level = 4.1

If I do this, will it be able to handle both my h264/x264 media and the occasional HEVC that I may need to process? Thanks in advance.

Yes you sure can.

Thanks much, works like a charm!

I noticed that one one of my conversions or failed with:

too many packets buffered for output

I found that this may be alleviated by using this:

-max_muxing_queue_size 1024

My question is can this be put in the autoprocess.ini file and if so what would be the format to use for adding this option? Thanks !

That’s pretty strange. I wouldn’t think that should be needed. A Queue of 1024 is pretty big.

Any chance you could make the file available to me to test with?
I’ve processed well over 50K files through the scripts to H.264 and now to H.265 and have never come across this. I’d love to see WHY this is happening to you.

I’ll PM you the details to the file when I get back home tomorrow. Thanks much!

Just let me know.

Noticed that some new files I added had ā€œEIA_608ā€ subtitles in them, but It seems I’m not able to remove them at all. Nothing was extracted into external files, and I can’t see subtitles in mkvmerge.

Any idea on this, and how to modify the conversion script to remove them? They seem to be force transcoding when subtitles are enabled by default

I am using the manual.py and I am having the strange issue with a few tv shows, where when converting it makes the .original.mp4 file and converts to 100% then it deletes both files and moves on to the next one. I don’t know how to see the reason. If I convert the files with ffmpeg it works fine and then I can process them with these scripts and it goes fine. Can someone point me in a direction?

EIA_608 aren’t actually subtitles but Closed Captioning which is a different animal entirely. This information is actually embedded in the video itself.

It can be removed with ffmpeg, I haven’t figured out how to detect them though. And I don’t stand a chance at python :frowning:

ffmpeg.exe -i ā€œinputfile.mkvā€ -codec copy -bsf:v ā€œfilter_units=remove_types=6ā€ ā€œoutput.mp4ā€

Why would you want to remove it? Maybe if transcoding the video but I wouldn’t do it if the video is already in the correct format.

Subtitles are on by default, which works fine as most of my subtitles are in srt format. But lately I’ve seen more and more files with these subtitles, which plex can’t play natively, and has to burn in - causing un-neccessary load on my server for subtitles in a language I don’t even use. Which is why I want them gone.

First if the subs aren’t in a language you don’t use then I’d assume you aren’t using them.
If you aren’t using them, then they won’t affect transcoding. It will only affect transcoding if they are being burned in.

Secondly SRT subs NEVER get burned in because they are text files, not graphics.

Third you can set options in the config file to only keep subs (any subs) that are only in languages that you want.

Fourth you can have the script remove all subs period.

Something was lost in translation here…
I’m aware that SRT subs don’t transcode (on 90% of clients).

My post is about EIA subtitles, which are not detected nor removed by the script.
They can be removed with ffmpeg with the command I wrote earlier, but I have not found any good way of detecting them automatically - nor do I know how to rewrite the script to detect and remove EIA subtitles if they are present.

Subtitles in my language is set to ON in my plex settings so I won’t have to manually choose them for everything I want to watch that has subtitles, this seems to automatically enable all other subtitles if prefered language is not present - hence enabling EIA subtitles in english with files that has these, and forcing a transcode by burning those in.

Sorry didn’t read back a few messages to catch that.

EIA 708 aren’t subtitles but the new replacement method for digital closed captioning meant for broadcast. They replace CEA-608 captioning that was embedded in Line 21 of the video signal.

The script doesn’t do anything with ā€œcaptioningā€ but only subtitles.

In any case the ffmpeg command line you provided won’t accomplish removing these as that filter only works on AVC based files, not mpeg2, nor will it touch line 21 in any way, shape or form. All that filter does is remove the ability to write meta-data.

I haven’t tested it but it could work for 708 based closed captioning if it’s an AVC file or your converting the file.

But I guess the question is Why try to remove the closed captioning? Why not just turn it off?

I use that line on mkv and mp4 files, and it does remove the EIA_608.
While I might be able to turn if off, that would be a setting that applies for clients, and that is a headache across different platforms and users, so it would be better to just remove it from the file and avoid any unneccessary transcoding that way.

As I said it would work with AVC files which is the common codec you’ll find in MP4 and MKV files. But it’s not going to work with recorded/broadcast files that are mpeg2 based which is the most common format you’ll find these in.

This isn’t something I would add because it would have limited support/use and would potentially mess up a lot of other things since you have meta-data that doesn’t match the contents of the file (not a fan of this).

To do this correctly would require probing the stream, then having logic that determines if this can be removed properly based on the codecs used and then adding the proper filters inline with any other filters being used and hoping the filters don’t have an adverse affect on each other.

If you use the scripts to convert to MP4 with H.264 then 90% of the work is done for you. What you could easily do is create a small batch file that will reprocess files after running through the script and does this removal which should be pretty quick (I’d think).

FYI: I don’t have any issues with closed captioning or subtitles being used when they shouldn’t or causing transcode issues in Emby which is my main server used these days.

I’m fairly new at all of this, so sorry for the dumb question, but will this cut down on the constant transcoding Plex is doing when my family is streaming? I know some things need to be transcoded but usually EVERYTHING is being transcoded constantly.