Optimized Versions for UHD Files?

Since I have a decent 4K Collection in the meantime (TVShows, Movies etc.) I was wondering if it is possible to have Plex generating optimized versions based on the resolution of the original content.

I am running the server on a Intel Skull Canyon Nuc (around 9.5k passmark) and it is barely possible for it to transcode a 4K stream (as long as the bitrate isn’t too high). I want to be able to enjoy the 4K Content on my TV but would love to have a 1080p version for my other devices and remote users that even further transcodes down if necessary.

One work around would be to have a seperate 4K library and not share it with remote users manually transcode all the 4K files with handbrake to 1080p and have them in another library.

The better solution imho would be to Plex let handle this. However, as long as even high end consumer processors (since quick sync is still no option in plex) usually aren’t capable of handling 4k transcoding (let alone multiple instances) I am wondering if this could work with optimized versions.

Therefore my questions are as follows:

  1. If I create a (1080p universal TV) optimized version of an originally 4K file, will this optimized file be picked by the PMS if a remote user calls for a 720p stream and live transcoded to 720p? Or is PMS dumb and tries to transcode the 4k File to 720p?

  2. Is it possible to somehow tell plex to create optimized versions during the scheduled maintenance time (as I don’t want to create optimized versions while possibly remote users or myself call for a transcode and the machine is already fully maxed out with creating those optimized versions)

  3. Or does PMS acknowledge the higher urgency for real time transcoding and lowers the priority of transcoding to an optimized version?

  4. Is is somehow possible to tell PMS to create optimized versions for all files based on resolution or bitrate or something like that or is this creating of optimized versions a manual only process?

1 - It depends on the client and the files. If you have a 20 Mbps 4K file and optimize to 4 Mbps and the client is set to 10 Mbps, it will choose the 4K file. If the client is set to 4 Mbps, it will pick the optimized version.
2 - Not possible,
3 - Yes, so you don’t need 2.
4 - You can based on resolution, but only within the same library. So go into a library, filter by the 4K resolution, then when you see the list filtered down, hit the optimize button on the left. This will create a smart job and any 4K files you add in the future will automatically get optimized.

Thank you for your fast and detailed answer!

Perfect! So Plex basically is doing what I want it to do, as long as I set the correct parameters! Many thanks!

Just one following up question on your answer of number 1:

Let’s assume I create a 12 Mbps 1080p optimized version of the original 4k 25 Mbps file. A client calls for a 4 Mbps 720p stream. Does Plex take the 12 Mbps 1080p optimized version and transcodes it to the desired 4 Mpbs or is Plex going to take the original 25 Mbps file and transcodes it to 720p 4 Mpbs?

EDIT:
After digging a bit deeper I discovered that several clients offer the selection of either file via play version. However I set up that optimize version as explained by MovieFan and choose Custom Unversal TV 12 Mbps with the very slow transcoding preset. I ended up witha 1080p 7 Mbps File? from an original 4K 29 Mbps File. Therefore selecting 1080p 8 Mbps created a 4K transcode session. Probably the reason being the very slow transcoder setting, therefore a smaller filesize.

Next I am going to try Custom: Universal TV 1080p 20 Mbps and report back with what I end up.

Alright so now I can report back with more specifics on the optimization:
I choose a 4K file, MKV with H264 (28109 kbps), AC3 5.1 (640 kbps). I optimized it to Custom Univeral Mobile 20 Mpbs 1080p and got an MP4 with H264 (7400 kpbs, AAC stereo 253 kbps).

Is there now a way to find out which file PMS chooses to transcode, if necessary? If I manually select play version -> 8 Mbit Custom Universal Mobile it transcodes this optimized version I assume. However what happens if a not so tech savvy user just hits play and then selects 4 Mbps? Is there any way to find out?

For Number 4, I would look into the MP4_Automator Script, it can be set to only convert files which meet a certain critera, for me personally anytime I had a non MP4 above 5.1 it will convert the (mkv) to MP4, web-optimize and add a 2nd audio track that will direct play for iOS users.

It has the option to delete or keep original file. Perhaps you may want to Keep your 4K library in a different folder and then you can choose to share/not to share with users who don’t have 4K, as well.

@mcboss86 said:
Alright so now I can report back with more specifics on the optimization:
I choose a 4K file, MKV with H264 (28109 kbps), AC3 5.1 (640 kbps). I optimized it to Custom Univeral Mobile 20 Mpbs 1080p and got an MP4 with H264 (7400 kpbs, AAC stereo 253 kbps).
That’s kind of odd that you got a 7400 Kbps output. Did you type something wrong because below you say 8 Mbps.
Is there now a way to find out which file PMS chooses to transcode, if necessary? If I manually select play version → 8 Mbit Custom Universal Mobile it transcodes this optimized version I assume. However what happens if a not so tech savvy user just hits play and then selects 4 Mbps? Is there any way to find out?
You can check the server log. At the start of playback, there will be a line that invokes the transcoder, so search for “PlexTranscoder” and you should see the input file listed. It should be picking the version that better matches the final output. So in your example, assuming your description is right, you have 1) Original and 2) Optimized to 20 Mbps. Unless the playback quality is set to original, the optimized version should always get chosen unless you manually choose the “Play Version” option.

Not to create a tangent, but I personally like to convert my 4K files using h.265 over h.264

  1. its faster
  2. Better Quality for the same settings (better visual quality)
  3. better compression for the same settings (smaller file size)

of course, you have to do that yourself using FFMPEG, I don’t believe plex has that as an option yet… PLUS and here is the real kicker, you need to have hardware that viewing hardware that supports x265 otherwise, plex just transcodes it anyways. but if you’re playing 4K files, then you likely have support for it.

@MovieFan.Plex said:
That’s kind of odd that you got a 7400 Kbps output. Did you type something wrong because below you say 8 Mbps.

I didn’t made a typo. It indeed is a 8 Mbit file as far as PMS is concerned (7400 kbit video, ~ 250 kbit audio = 7650 → 8 Mbit in the option menu “play version”.

@wesman thanks for your input. I did consider this option but I really don’t want to manually manage transcoding etc.

Help please :slight_smile:

Alright I did what was suggested with the whole 4K library, basically creating 1080p optimized versions. Now as it seems the transcoder is still using the 2160p version and therefore my ability to serve multiple transcodes as soon as a 4K file is streamed is almost gone.

Below you find the excerpt from the PlexMediaServer.log. The device used is my Nexus 5X. I didn’t choose any version and set the quality to 4Mbps 720p before hitting that play button.

I am providing the xml file of the played tv show episode as an attachment. There you can clearly see, that PMS has an optimized version available 1080p universal mobile with 8055 kbps.

Why is the transcoder still picking up the 4K video and transcodes it to 720p?

Jan 11, 2017 15:32:10.026 [5412] DEBUG - Starting a transcode session 93a01adefa85b7b0-com-plexapp-android at offset -1.0 (state=3)
Jan 11, 2017 15:32:10.041 [5412] DEBUG - [Universal] Using local file path instead of URL: Y:\TVShows\Gilmore Girls- A Year in the Life\Season 01\Gilmore Girls- A Year in the Life - S01E02 - Spring WEBDL-2160p TrollUHD.mkv
Jan 11, 2017 15:32:10.041 [5412] DEBUG - Job running: FFMPEG_EXTERNAL_LIBS=’\\?\C:\Users\Username\AppData\Local\Plex\ Media\ Server\Codecs\c9ea179-1157-windows-i386\’ XDG_CACHE_HOME=‘C:\Users\Username\AppData\Local\Plex Media Server\Cache’ XDG_DATA_HOME=‘C:\Program Files (x86)\Plex\Plex Media Server\Resources’ X_PLEX_TOKEN=‘xxxxxxxxxxxxxxxxxxxx’ C:\Program Files (x86)\Plex\Plex Media Server\PlexTranscoder.exe -codec:0 h264 -codec:1 ac3_mf -i “Y:\TVShows\Gilmore Girls- A Year in the Life\Season 01\Gilmore Girls- A Year in the Life - S01E02 - Spring WEBDL-2160p TrollUHD.mkv” -map_inlineass 0:2 -filter_complex “[0:0]scale=w=min(1280,iw):h=min(720,ih):force_original_aspect_ratio=decrease,format=pix_fmts=yuv420p|nv12,inlineass=font_scale=1.000000:font_path=C\:\\Program\\ Files\\ (x86)\\Plex\\Plex\\ Media\\ Server\\Resources\\Fonts\\DejaVuSans-Regular.ttf[0]” -map [0] -codec:0 libx264 -crf:0 16 -maxrate:0 4000k -bufsize:0 8000k -r:0 23.975999999999999 -preset:0 veryfast -level:0 4.0 -x264opts:0 subme=1:me_range=4:rc_lookahead=10:me=hex:8x8dct=0:partitions=none -force_key_frames:0 expr:gte(t,0+n_forced*3) -map 0:1 -metadata:s:1 language=eng -codec:1 aac -ar:1 48000 -channel_layout:1 stereo -b:1 258k -segment_format mpegts -f ssegment -individual_header_trailer 0 -segment_time 3 -segment_start_number 0 -segment_copyts 1 -segment_time_delta 0.0625 -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 media-%05d.ts -map 0:2 -f null -codec copy nullfile -start_at_zero -copyts -vsync cfr -y -nostats -loglevel quiet -loglevel_plex error -progressurl http://127.0.0.1:32400/video/:/transcode/session/93a01adefa85b7b0-com-plexapp-android/progress
Jan 11, 2017 15:32:10.268 [5132] DEBUG - Auth: We found auth token (xxxxxxxxxxxxxxxxxxxx), enabling token-based authentication.

Anyone maybe able to help me?

Would be really much appreciated. Because as it is now it is a terrible idea to have 4K video files in your standard libraries as my quite powerful Skull Canyon Nuc is only able to handle 1 transcode. The above mentioned is not a single issue but PMS standard behaviour. If you don’t select “play version” 1080p manually it will take the 4K version and transcodes it to whatever a user is requesting.

If it isn’t automatically handling at least PMS should use the optimized version as standard instead of using the non optimized 4K version as standard.

I hope someone can help me. Otherwise it seems I have to take all the 4K files and put them in a seperate library :frowning:

Best regards from Switzerland.

Ok, I found some info for you. When a transcode is needed, PMS will prefer to use the original video as the source, regardless of the quality selected in the player. You use the optimized version as the source, you do need to manually select “Play Version”. The thinking is that the optimized version has already had a reduction in quality and making a copy of a copy is not usually a good idea.

There is not a way to make PMS automatically select the optimized version as the source when transcoding is needed. Looks like putting these into a separate library is your best option. Or if you know you need a 4 Mbps version, use that as the optimized setting so it can then direct play and not need to be transcoded.

Just came here looking for the same bit of info, it would be great to be able to tell Plex to automagically select the optimized version when there is one available as that makes the most sense from a usability and effeciancy standpoint. Getting others to remember to manually select a optimized version when available isn’t a very solid solution as it relys on others to remember things - I can remember no problem but if my parents were going to watch a movie they wouldn’t have the foggiest ahead how to switch nor would they remember to. The optimized versions are optimized for a reason, now we just need a option to tell plex to actually use them when available. If I have upstream limited to 10Mbps per user, I should be able to optimize some versions to 10 or 12Mbps to minimize the need to transcode and tell plex to select that automatically otherwise there isn’t much point to a optimized version.

Honestly surprised it didn’t work this way - I optimized a episode of a TV show and it still look almost 5 seconds to start on a i7-7700k while transcoding to my phone despite a optimized version being available.

The current idea behind optimized versions was to create a version that will direct play. not necessarily act as a substitute for the original file. I can see how the optimized version could be preferred for performance, but it would be a bad choice in terms of quality. I’ve posed the question internally for discussion. If you would like to make a feature request and add in your own thoughts, that would be useful.

@MovieFan.Plex this would make a great option if done correct.

Select Maximum file size “1080 8MB” (or lower) to transcode from.
Select Minimum file size “720 4MB” (or higher) to transcode from. <-- optional

Both the resolution and bitrate could be drop downs. Ideally if you have multiple versions it would choose the HIGHEST version that is under the MAXIMUM you selected above.

This would allow a person to create said 1080 8MB as a “default” conversion and then be able to use this to transcode from for lower resolutions or bitrates.

There is not going to be a huge difference in quality from the 1080 8MB and say a 4K 25MB file once it’s went through the transcoder to create a 1080 4MB or 720 4MB file. It will however use a LOT LESS CPU to do the conversion/transcode.

If the system didn’t have any other files equal or smaller than the 1080 8MB setting it would use the original file.

We could optionally have a minimum setting as well. This way if the person created a mobile version similar to “720 2MB” it wouldn’t get used as the “master” if it were the only file available besides the original.

So basically use the highest quality version that fits the criteria from minimum to maximum that was set. This will save many CPU resources on transcodes.

Carlo

@wesman said:
Not to create a tangent, but I personally like to convert my 4K files using h.265 over h.264

  1. its faster
  2. Better Quality for the same settings (better visual quality)
  3. better compression for the same settings (smaller file size)

of course, you have to do that yourself using FFMPEG, I don’t believe plex has that as an option yet… PLUS and here is the real kicker, you need to have hardware that viewing hardware that supports x265 otherwise, plex just transcodes it anyways. but if you’re playing 4K files, then you likely have support for it.

Huge tangent, no contribution to content of thread. Sound about right! :smiley:

@cayars said:
@anon18523487 this would make a great option if done correct.

The same can be said for any idea. :slight_smile:

Wise Guy :slight_smile:

But so true!

Well yeah I am also quite disappointed that plex apparently isn’t able to do this. Basically the way it is now the optimized versions are completely useless in most cases. As the owner of the server I know about them and can use them for direct play if I am away and have the right device with me, which is capable of direct playing.

You see what I am trying to tell you: There are 3 variables (right device to direct play, knowledge, correct upload speed at this given moment) necessary to check, that an optimized version even comes into play.

And for those rare circumstances you need your processor convert it and use quite a bit of additional storage.

Especially in the next 1 or 2 years, where 4K files will be available but most content is still in 1080p I hoped for those optimized versions.

Well at least the transcoding issue will be hopefully quite mitigated by the soon implementation of hardware accelerated transcoding.