# \[Bug?\] Transcoder quality overriding TranscodeH264Preset and TranscodeH264BackgroundPreset

**URL:** <https://forums.plex.tv/t/bug-transcoder-quality-overriding-transcodeh264preset-and-transcodeh264backgroundpreset/849984>\
**Category:** Plex Media Server\
**Tags:** server-docker\
**Created:** [August 9, 2023, 5:46pm UTC](https://forums.plex.tv/t/bug-transcoder-quality-overriding-transcodeh264preset-and-transcodeh264backgroundpreset/849984 "2023-08-09T17:46:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrFrizzy](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@MrFrizzy](https://forums.plex.tv/u/MrFrizzy)\
**Post date:** [August 9, 2023, 5:46pm UTC](https://forums.plex.tv/t/bug-transcoder-quality-overriding-transcodeh264preset-and-transcodeh264backgroundpreset/849984/1 "2023-08-09T17:46:48Z")

</div>

Server Version#: 1.32.5.7349

In my `preferences.xml` file, I have `TranscoderQuality="3" TranscoderH264Preset="medium" TranscoderH264BackgroundPreset="veryslow"`. I can see in the debug logs that those presets are getting passed to the transcoder when a file is either on-the-fly transcoded or part of the Media Optimizer. However, the `-x264opts` from the `Transcoder quality` setting are still getting passed to the transcoder effectively overriding some options of the selected preset.

For example, when doing a “Media Optimizer” job, I see the below in the debug logs:

```auto
Aug 08, 2023 12:31:31.853 [23009161046840] DEBUG - [...] "/usr/lib/plexmediaserver/Plex Transcoder" -codec:0 h264 -codec:1 eac3_eae -eae_prefix:1 ff559808-0a6e-4559-8872-10079be1b07a_ -analyzeduration 20000000 -probesize 20000000 -i /data/TestLib/Movies/test_movie.mkv -filter_complex "[0:0]scale=w=1280:h=536:force_divisible_by=4[0];[0]format=pix_fmts=yuv420p|nv12[1]" -map "[1]" -codec:0 libx264 -crf:0 18 -maxrate:0 4000k -bufsize:0 8000k -r:0 23.975999999999999 -preset:0 veryslow -level:0 4.0 -x264opts:0 subme=2:me_range=4:rc_lookahead=10:me=hex:8x8dct=1 -filter_complex "[0:1] aresample=async=1:ochl='stereo':rematrix_maxval=0.000000dB:osr=48000[2]" -map "[2]" -metadata:s:1 language=eng -codec:1 aac -b:1 216k -f mp4 -map_metadata -1 -map_chapters -1 -movflags [...]

```

As you can see, `-preset:0 veryslow` gets passed in, but then `-x264opts:0 subme=2:me_range=4:rc_lookahead=10:me=hex` are overriding the `veryslow` preset options of `subme=10:me_range=24:rc_lookahead=60:me=umh`.

Same goes for any on-the-fly transcode:

```auto
Aug 09, 2023 11:47:57.114 [23403113483064] DEBUG - [...] "/usr/lib/plexmediaserver/Plex Transcoder" -codec:0 h264 -codec:1 aac -analyzeduration 20000000 -probesize 20000000 -i /data/TestLib/Movies/test_movie.mkv -filter_complex "[0:0]scale=w=1280:h=536:force_divisible_by=4[0];[0]format=pix_fmts=yuv420p|nv12[1]" -map "[1]" -codec:0 libx264 -crf:0 22 -maxrate:0 3368k -bufsize:0 6736k -r:0 23.975999999999999 -preset:0 medium -x264opts:0 subme=2:me_range=4:rc_lookahead=10:me=hex:8x8dct=1 -force_key_frames:0 "expr:gte(t,n_forced*5)" -filter_complex "[0:1] aresample=async=1:ochl='5.1':rematrix_maxval=0.000000dB:osr=48000[2]" -map "[2]" -metadata:s:1 language=eng -codec:1 libopus -b:1 420k -segment_format matroska -f ssegment -individual_header_trailer 0 -flags +global_header -segment_header_filename header -segment_time 5 -segment_start_number 0 -segment_copyts 1 -segment_time_delta 0.0625 -segment_list [...]

```

`-preset:0 medium` gets passed in, but then `-x264opts:0 subme=2:me_range=4:rc_lookahead=10:me=hex` are overriding the `medium` preset options of `subme=7:me_range=16:rc_lookahead=40`.

My current workaround is to add `TranscoderH264OptionsOverride="subme=7:me_range=16:rc_lookahead=40` to the `preferences.xml` in order to force the transcoder to use my `-x264opts` instead of what is passed in by the `TranscoderQuality` setting. The problem is, the Media Optimizer is still using the `TranscoderH264OptionsOverride` setting meaning the `preset="veryslow"` is still getting overridden by some lesser options.

I would request two things:

1. Add a 4th `Transcode quality` level to either no longer pass in `-x264opts` to the transcoder (use only those from the hidden `TranscoderH264OptionsOverride`) or to pass in a custom list of options (perhaps a new GUI link to the hidden `TranscoderH264OptionsOverride`).
2. Have the Media Optimizer completely ignore the `TranscoderQuality` setting (only follow the selected background preset) or add a new option somewhere such as `TranscoderH264BackgroundOptionsOverride` to specify specific `-x264opts` flags for background transcodes.

I can provide logs in a DM if any Devs or Mods need them. I don’t wish to post them publicly.

---

<div class="post-metadata">

**Author:** ![Volts](https://avatars.discourse-cdn.com/v4/letter/v/a5b964/32.png) [@Volts](https://forums.plex.tv/u/Volts)\
**Post date:** [August 9, 2023, 6:48pm UTC](https://forums.plex.tv/t/bug-transcoder-quality-overriding-transcodeh264preset-and-transcodeh264backgroundpreset/849984/2 "2023-08-09T18:48:43Z")

</div>

Are you chasing a specific quality problem? If you can demonstrate better settings, you might have more luck encouraging Plex to adjust the default settings.

If you search the forum for **TranscoderH264OptionsOverride** you’ll find some ancient comments. There are some additional reasons the behavior may be different, too.

There have been a few interesting hacks where people swap out the `Plex Transcoder` binary with a script, and use that script to match-and-edit the arguments. A couple links here -

[Script to regenerate video previews multi threaded? - #9 by Volts](https://forums.plex.tv/t/script-to-regenerate-video-previews-multi-threaded/788360/9)

---

<div class="post-metadata">

**Author:** ![MrFrizzy](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@MrFrizzy](https://forums.plex.tv/u/MrFrizzy)\
**Post date:** [August 10, 2023, 5:21am UTC](https://forums.plex.tv/t/bug-transcoder-quality-overriding-transcodeh264preset-and-transcodeh264backgroundpreset/849984/3 "2023-08-10T05:21:24Z")

</div>

> Are you chasing a specific quality problem?

Yes and no.

I find that the “Make my CPU hurt” option provides pretty terrible quality for on-the-fly transcodes. I had setup the `TranscoderH264Preset="medium"` option months ago in attempt to significantly increase the quality of those transcodes. While the quality is better, it is still not good. My other attempt at improving the quality of transcodes was to use the Media Optimizer to use the “veryslow” preset to get essentially the best quality I can out of the 720p 4Mbps profile. It was when I noticed that the process was hitting 2-6x speeds that I knew that something was not right. Upon checking the output in the “Plex Versions” folder, I saw that the encoder settings used were not what I would normally see in a “veryslow” preset encode. More specifically, the `-x264opts:0 subme=2:me_range=4:rc_lookahead=10:me=hex` options being closer to the “veryfast” preset.

So, that is to say that the problem is Plex not allowing me to select or otherwise configure the transcodes to be at a much higher quality. I have plenty of CPU to handle multiple “medium” preset encodes simultaneously and I want Plex to take advantage of that. If the on-the-fly transcoder would just follow the “medium” preset, I would not even bother with the Media Optimizer. On the other hand, if the Media Optimizer followed the `TranscodeH264BackgroundPreset` completely without the “Make my CPU hurt” (or any other `TranscoderQuality` setting) overriding some of the preset options with much lower quality ones, I would at least have another option to actually optimize my media.

At this time, the Media Optimizer using the “veryslow” preset offers very little quality improvement over the on-the-fly transcodes because both of them are using the same values for the `subme, me_range, rc_lookahead` and `me` options that are simply too low for a quality output. It feels like I am stuck with settings appropriate for a processor from 2012.

Thanks for the link. I’ll have to dig through that and see what I can gather from it.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [November 8, 2023, 5:22am UTC](https://forums.plex.tv/t/bug-transcoder-quality-overriding-transcodeh264preset-and-transcodeh264backgroundpreset/849984/4 "2023-11-08T05:22:00Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
