Why is Plex identifying SD video as 576p?

@jonkv said:
You also find it in Plex, unfortunately. When transcoding is required, Plex applies the following to my 720x576 DVR recordings:

-filter_complex [0:0]scale=w=min(720\,iw):h=min(576\,ih):force_original_aspect_ratio=decrease,...

So it wants square pixels within a 720x576 frame, which turns into 720x404.

And that right there is deep into Wombat territory and is the #1 reason I make sure ALL my material Direct Plays before I ever add it to my libraries. Plex’s transcode routine doesn’t know how to work (or chooses not to work) with DVD material - so the absolute lowest/easiest/Wombattiest method is employed resulting in something that doesn’t cut the mustard - around here anyway.

576 - 404 = 172. 172 pixels immediately discarded through a Wombat Encode never to be seen. When you only have 576 pixels of resolution to begin with, whacking 172 off of that is a BIG BITE!

The forum is often populated with posts wondering why a Plex transcode destroys the quality of an item - and it’s not really a mystery when you find out what’s happening. I know it’s done to make it as easy as possible on sub-par servers - and there are a LOT of them - but everyone that cares can avoid that situation with a Direct Play.

@jonkv said:
You also find it in Plex, unfortunately. When transcoding is required, Plex applies the following to my 720x576 DVR recordings:

-filter_complex [0:0]scale=w=min(720\,iw):h=min(576\,ih):force_original_aspect_ratio=decrease,...

So it wants square pixels within a 720x576 frame, which turns into 720x404.

Can you post the entire XML for that video? If PMS is making that change, then your file must have that info in there somewhere for PMS to pick up on it. PMS does not apply anamorphic settings for no reason.

Apparently Plex doesn’t apply anamorphic settings - period.

Every time I induce a transcode for a perfect 720x480 16:9 encode the result is 720x404 and a destroyed, ultra-low quality experience.

Been this way for YEARS. Plex never taught the transcoder to do anamorphic for DVDs and this may be at least a part of the reason why the ball has been dropped on this resolution issue.

Solution: Never allow Plex to transcode ANYTHING especially where DVDs are concerned. It’s notorious for turning a silk purse into a sow’s ear. When you’re working with 480p or 576p you need every one of those p’s you can get and Plex just can’t get the job done.

It’s real easy to reproduce. Find a proper DVD 16:9 encode stored at 720x480 and induce a transcode - look at the rez (easy on a FireTV). There it is. Every time.

Stupid question… and yes, side tracking a bit. What if you had everything else set / locked to direct play? I pull direct from DVD and haven’t run into this at all. I guess it’s the whole HandBrake forced ‘anamorphic’ trying to be overly helpful? (I rip from the disk directly and leave as-is, converting the audio track and dropping any subs in the remux.)

Umm. 720x480 is not 16:9.

Plex should be applying anamorphic settings based on the anamorphic flag and the pixel aspect ratios. Some files have a display aspect ratio which is basically an override and Plex might be ignoring these.

@ChuckPA said:
Stupid question… and yes, side tracking a bit. What if you had everything else set / locked to direct play? I pull direct from DVD and haven’t run into this at all. I guess it’s the whole HandBrake forced ‘anamorphic’ trying to be overly helpful? (I rip from the disk directly and leave as-is, converting the audio track and dropping any subs in the remux.)

I normally get all my stuff to Direct Play - that’s my goal, but if some poor user gets a sub-induced transcode things spiral downhill pretty fast.

I don’t use any ‘automatic’ Handbrake presets. Everything is hands on so I’m certain I get exactly what is required for a perfect DVD rip. Handbrake Guide is in my sig - my ‘gift’ to the community in an effort to get things Direct Playing - very important for DVDs as you can probably imagine.

@MovieFan.Plex said:
Umm. 720x480 is not 16:9.

No, sir, it is not. 854x480 is 16:9. DVD ‘Storage’ vs DVD ‘Displayed’, all set up via the 20+ year old Industry Standard for DVDs. Anamorphic settings are ONLY required for DVDs. BluRay discs can hold the native resolution. DVDs can only hold 720x480. We’ve been over this ad-nausium, so you’ll have to catch up. The Handbrake Guide in my signature may be of some help.

Plex should be applying anamorphic settings based on the anamorphic flag and the pixel aspect ratios. Some files have a display aspect ratio which is basically an override and Plex might be ignoring these.

I’m sure I don’t know what’s going on over at Plex HQ, but 720x404 is and has been the result of a 16:9 DVD Plex Style transcode since I were knee-high to a grasshoppah, grasshoppah. :slight_smile:

The last couple of posts have gone full circle, almost back to my original. It was a 2-parter…

Question 1 - why is a 16x9 video with a size of 720X404 now identified as 576p, when it used to be labeled SD?
Question 2 - will this effect Plex’s decision to transcode?

Frankly, I don’t care if it’s a bad encode, or if it doesn’t meet DVD standards, or what anamorphic settings are used. The point is, that low bit-rate video that consistently direct played on devices set to a quality setting of 480p/1.5Mbps are now transcoding, or at best remuxing to a direct stream. If they do a full transcode, they actually encode the new video at 720X404 - the same size as the original.

I can’t say with any knowledge that the new 576p, 480p, etc designations and the recent decisions by Plex to transcode videos it previously Direct played are related, but I do know, that coincidentally, both happened at the same time.

@ChuckPA said:
I am searching for a log file which shows specifically where:

  1. MDE makes the decision to transcode
  2. video.height 576 > 480

Recently grabbed the logs from a Roku that made the decision to transcode with those lines.

The original video is 720X404, labeled as 576p by Plex. The video is progressive, not interlaced, previously identified as SD. I’m not a genius, but it seems to me the 576 can only be coming from the designation Plex gives it.

The video height is 404, obviously less than 576. The width is 720, equal to an actual PAL broadcast/DVD, and less than the 1024 pixels you could argue it is displayed at if Plex actually makes other calculation based on video.height 576 > 480.

Yep.

Plex doesn’t need to get into that file for some complex calculations that could be based on Wombat Poop to figure out what it’s resolution is.

These are ‘Stored’ resolutions or Non-Standard resolutions based solely on aspect ratio:
720x404 (lots of these around) should be SD.
720x480 (lots of these around) should be 480.

720x468 (is that the PAL equivalent to 720x404? Let’s say it is) should be SD.
720x576 (Lots of these around in PAL Lands, I assume) 576.

That’s pretty much where Plex should stop worrying about it! 720x404/720x468 could be argued as legit and it is in the fact that it’s the right aspect ratio, but it’s SD and everybody is fine with that.

Anything else is really out of whack and should be SD up until the point it becomes HD, and this BS news that we’re going to have SD, HD and UHD is about the most ridiculous thing I ever heard - can’t make it work so throw a blanket over it? C’mon!

Plex is overthinking this thing in a big way.

Plex should be transcoding based entirely on the bit rate, not the aspect ratio or resolution. What’s that all about?

So it wants square pixels within a 720x576 frame, which turns into 720x404.

Can you post the entire XML for that video? If PMS is making that change, then your file must have that info in there somewhere for PMS to pick up on it. PMS does not apply anamorphic settings for no reason.

I’m including the XML for one 16:9 video that was first recorded by Plex DVR (720x576 MPEG-2 interlaced) and then converted through a set of scripts. When I play this on a Chromecast, the expected result would be that it transcodes into a codec the Chromecast understands but either (1) keeps the same storage format, 720x576, together with whatever flags are used to indicate the correct display aspect ratio to the Chromecast, or (2) at least expands it to 1024x576 if it really wants to send square pixels to the Chromecast. The actual result is that it throws away a significant part of the video information, and I can’t find a way to keep it except pre-transcoding the video outside of Plex so that no video transcoding is required when I watch it.

The playback settings on the iPad from which I start the video are 20 Mbps 1080p, so this should not be the reason why Plex wants to keep everything within a 720x576 window with square pixels.

Example of a Plex Transcoder command line from “ps auxwww”, when I play this on a Chromecast:

plex     27451  414  0.3 1092812 126532 ?      Sl   08:12   0:20 /usr/lib/plexmediaserver/Plex Transcoder -codec:0 hevc -i /raid/film/dvr/Watchmen (2009)/Watchmen (2009).mkv -filter_complex [0:0]scale=w=min(720\,iw):h=min(576\,ih):force_original_aspect_ratio=decrease,format=pix_fmts=yuv420p|nv12[0] -map [0] -codec:0 libx264 -crf:0 16 -maxrate:0 6462k -bufsize:0 12924k -r:0 25 -preset:0 veryfast -level:0 4.2 -x264opts:0 subme=2:me_range=4:rc_lookahead=20:me=hex -map 0:1 -codec:1 copy -copypriorss:1 0 -f segment -segment_format matroska -segment_format_options live=1 -segment_time 1 -segment_header_filename header -segment_start_number 0 -segment_list http://127.0.0.1:32400/video/:/transcode/session/h0v9qklkbkpjsq1py3cl92j4/seglist -segment_list_type csv -segment_list_size 2147483647 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 chunk-%05d -start_at_zero -copyts -y -nostats -loglevel quiet -loglevel_plex error -progressurl http://127.0.0.1:32400/video/:/transcode/session/h0v9qklkbkpjsq1py3cl92j4/progress

PlexPy’s status page states that this results in a resolution of 718x404. Mediainfo identifies the tiny result header file in the transcoder directory as follows:

$ mediainfo /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Cache/Transcode/Sessions/plex-transcode-h0v9qklkbkpjsq1py3cl92j4-419f54a9-b507-4454-97b0-d1362d8e1626/header 
General
Unique ID                                : 187657433988074149168396691496376403144 (0x8D2D81D3F4E087A10E0FC53105AF04C8)
Complete name                            : /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/Transcode/Sessions/plex-transcode-h0v9qklkbkpjsq1py3cl92j4-419f54a9-b507-4454-97b0-d1362d8e1626/header
Format                                   : Matroska
Format version                           : Version 4 / Version 2
File size                                : 719 Bytes
Duration                                 : 2 h 29 min
Overall bit rate                         : 1 b/s
Writing application                      : Lavf57.57.100
Writing library                          : Lavf57.57.100 / Lavf57.57.100
IsTruncated                              : Yes

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.2
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 2 h 29 min
Width                                    : 720 pixels
Height                                   : 404 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 1 000.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Writing library                          : Lavc57.65.100 libx264
Default                                  : Yes
Forced                                   : No

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : A_AAC
Duration                                 : 2 h 29 min
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 spf)
Compression mode                         : Lossy
Default                                  : Yes
Forced                                   : No

@leelynds said:
I can’t say with any knowledge that the new 576p, 480p, etc designations and the recent decisions by Plex to transcode videos it previously Direct played are related, but I do know, that coincidentally, both happened at the same time.

It would be awful to know that Plex is using a badly placed label (576p or 480p) as a parameter to decide whether to transcode or not. I don’t want to believe that :open_mouth:

@JuiceWSA said:
These are ‘Stored’ resolutions or Non-Standard resolutions based solely on aspect ratio:
720x404 (lots of these around) should be SD.
720x480 (lots of these around) should be 480.

720x468 (is that the PAL equivalent to 720x404? Let’s say it is) should be SD.

It should be 720x404 in both PAL and NTSC: since the pixels are square there’s no difference and 16:9 “wombat approved” resolution is 720x404 :slight_smile: I don’t know where 720x468 comes from

Plex is overthinking this thing in a big way.

And also in a “bad” way :smiley:

Plex should be transcoding based entirely on the bit rate, not the aspect ratio or resolution. What’s that all about?

Agreed. I was thinking the same thing.

@jonkv said:

Do you remember how you could use a 768x576 doublePal resolution filling the entire 4:3 screen with square pixels? Ah the good old times ;D

I’m not sure I ever did that, but they sure were good :slight_smile:

I think this was not possible on a standard TV, but with the multisync monitor from Commodore you could squeeze all that pixels :smiley:

@zpaolo11x said:

@JuiceWSA said:
These are ‘Stored’ resolutions or Non-Standard resolutions based solely on aspect ratio:
720x404 (lots of these around) should be SD.
720x480 (lots of these around) should be 480.

720x468 (is that the PAL equivalent to 720x404? Let’s say it is) should be SD.

It should be 720x404 in both PAL and NTSC: since the pixels are square there’s no difference and 16:9 “wombat approved” resolution is 720x404 :slight_smile: I don’t know where 720x468 comes from

Plex is overthinking this thing in a big way.

And also in a “bad” way :smiley:

Plex should be transcoding based entirely on the bit rate, not the aspect ratio or resolution. What’s that all about?

Agreed. I was thinking the same thing.

Well, I guess if @leelynds lived in PAL territory he’d be maintaining an aspect ratio. Is 720x468 a 16:9 aspect ratio for a PAL DVD? I don’t know really, but I assume it is. It sounds about right. If I lived in the UK I’d know, but West Virginia is DEEP into NTSC territory. DEEP!

:slight_smile:

@JuiceWSA said:
Well, I guess if @leelynds lived in PAL territory he’d be maintaining an aspect ratio. Is 720x468 a 16:9 aspect ratio for a PAL DVD? I don’t know really, but I assume it is. It sounds about right. If I lived in the UK I’d know, but West Virginia is DEEP into NTSC territory. DEEP!

Maybe it could be the resolution of a PAL DVD with 4:3 aspect ratio and a letterboxed 16:9 movie… I’ll do the math… No it should be 720x432. I mean, if you have a 720x576 frame filling a 4:3 TV, but your movie is 16:9 with black bars (like non widescreen DVDs of 16:9 movies), the movie frame should be 432 pixel tall, with the other pixels black bars.

I’m just glad I only have to deal with one format.

I feel Plex’s pain, but it’s on them to figure it out. Nobody made them get into this line of work. If they knew then what they know now they might be manufacturing Garden Gnomes instead of developing Media Server Solutions.

lol

@jonkv said:
So it wants square pixels within a 720x576 frame, which turns into 720x404.

It doesn’t want square pixels. It uses whatever pixel aspect ratio your file says it is. Your XML shows that your file has pixelAspectRatio="64:45". PMS does not upscale video so 720x404 is correct.

@MovieFan.Plex said:

@jonkv said:
So it wants square pixels within a 720x576 frame, which turns into 720x404.

It doesn’t want square pixels. It uses whatever pixel aspect ratio your file says it is. Your XML shows that your file has pixelAspectRatio="64:45". PMS does not upscale video so 720x404 is correct.

No, it is not correct. Stored, that file is 720x576. Displayed it is 1024x576. Transcoding by Plex will annihilate it because the transcoder doesn’t know what it’s doing. Displaying a DVD encode at it’s proper dimensions is NOT ‘upscaling’ it. It is how every player on Planet Earth has dealt with DVD material for decades.

If Plex’s transcoder was doing it’s job right it would transcode a version of that file with it’s proper anamorphic flag, send it to the player packed up properly at 720x576 wherein the player would gleefully accept it just like any other properly encoded DVD rip and display it properly at 1024x576. This proves without a shadow of a doubt Plex’s transcoder is ill equipped to handle a DVD correctly.

Here is the MediaInfo report for that file I attached for Chuck:

! General
! Complete name : G:\TV SciFi\Stargate SG-1\Season 01\Stargate SG-1 - S01E03 - The Enemy Within.mp4
! Format : MPEG-4
! Format profile : Base Media / Version 2
! Codec ID : mp42 (isom/iso2/avc1/mp41)
! File size : 786 MiB
! Duration : 44 min 13 s
! Overall bit rate mode : Variable
! Overall bit rate : 2 486 kb/s
! Encoded date : UTC 2016-06-14 21:43:06
! Tagged date : UTC 2016-06-14 21:43:06
! Writing application : HandBrake 0.10.5 2016021100
!
! Video
! ID : 1
! Format : AVC
! Format/Info : Advanced Video Codec
! Format profile : High@L4.1
! Format settings, CABAC : Yes
! Format settings, ReFrames : 5 frames
! Codec ID : avc1
! Codec ID/Info : Advanced Video Coding
! Duration : 44 min 13 s
! Bit rate : 2 157 kb/s
! Width : 720 pixels
! Height : 480 pixels
! Display aspect ratio : 16:9
! Original display aspect ratio : 16:9
! Frame rate mode : Variable
! Frame rate : 24.176 FPS
! Minimum frame rate : 19.978 FPS
! Maximum frame rate : 29.970 FPS
! Color space : YUV
! Chroma subsampling : 4:2:0
! Bit depth : 8 bits
! Scan type : Progressive
! Bits/(Pixel*Frame) : 0.258
! Stream size : 682 MiB (87%)
! Writing library : x264 core 142 r2479 dd79a61
! Encoding settings : cabac=1 / ref=5 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=4 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=62500 / vbv_bufsize=78125 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
! Encoded date : UTC 2016-06-14 21:43:06
! Tagged date : UTC 2016-06-14 21:43:06
! Color range : Limited
! Color primaries : BT.601 NTSC
! Transfer characteristics : BT.709
! Matrix coefficients : BT.601
! Menus : 3
!
! Audio
! ID : 2
! Format : AAC
! Format/Info : Advanced Audio Codec
! Format profile : LC
! Codec ID : 40
! Duration : 44 min 12 s
! Bit rate mode : Variable
! Bit rate : 321 kb/s
! Channel(s) : 2 channels
! Channel positions : Front: L R
! Sampling rate : 48.0 kHz
! Frame rate : 46.875 FPS (1024 spf)
! Compression mode : Lossy
! Stream size : 102 MiB (13%)
! Title : Stereo / Stereo
! Language : English
! Default : Yes
! Alternate group : 1
! Encoded date : UTC 2016-06-14 21:43:06
! Tagged date : UTC 2016-06-14 21:43:06
! Menus : 3
!
! Menu
! ID : 3
! Codec ID : text
! Duration : 44 min 12 s
! Language : English
! Encoded date : UTC 2016-06-14 21:43:06
! Tagged date : UTC 2016-06-14 21:43:06
! Bit rate mode : CBR
! Menu For : 1,2
! 00:00:00.000 : Chapter 1
! 00:09:22.295 : Chapter 2
! 00:11:38.998 : Chapter 3
! 00:15:45.611 : Chapter 4
! 00:22:10.729 : Chapter 5
! 00:28:33.845 : Chapter 6
! 00:35:29.194 : Chapter 7
! 00:41:34.625 : Chapter 8
!

Every player on Planet Earth (including every player in every Plex app) knows that file is stored at 720x480, but for playback it needs to display at 854x480 - and it does - unless Plex’s transcoder gets it’s grubby paws on it, stomps the life out of it then throws it in a wadded up ball at 720x404 to the player.

The moral of this story is, folks - don’t let Plex transcode anything, or deal with what happens when it does.

@MovieFan.Plex said:

@jonkv said:
So it wants square pixels within a 720x576 frame, which turns into 720x404.

It doesn’t want square pixels. It uses whatever pixel aspect ratio your file says it is. Your XML shows that your file has pixelAspectRatio="64:45". PMS does not upscale video so 720x404 is correct.

What I mean is that Plex Transcoder rescales the video in order to change it from the original resolution of 720x576 with a display aspect ratio of 16:9 and therefore a pixel aspect ratio of 64:45, to a resolution of 720x404 with the same display aspect ratio but a new pixel aspect ratio of 1:1. So yes, it uses whatever pixel aspect ratio my file says it is, but only in order to transcode every frame to square pixels.

The following is essentially the same command line that was used for Plex Transcoder in my example above, except that I have switched to plain ffmpeg, removed the segment-based options, limited the transcoding to 60 seconds (-t 60) and redirected the output to /tmp/movie.mkv:

ffmpeg -codec:0 hevc -i "/raid/film/dvr/Watchmen (2009)/Watchmen (2009).mkv" -filter_complex "[0:0]format=pix_fmts=yuv420p|nv12[0]" -map "[0]" -codec:0 libx264 -crf:0 16 -maxrate:0 6462k -bufsize:0 12924k -r:0 25 -preset:0 veryfast -level:0 4.2 -x264opts:0 "subme=2:me_range=4:rc_lookahead=20:me=hex" -map 0:1 -codec:1 copy -copyts -y -nostats -t 60 /tmp/movie.mkv

The result is a transcoded file using H264 (which my Chromecast likes), but in the original resolution, without any downscaling or upscaling.

...
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 1 min 0 s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9

This also shows up as 720x576 in players such as VLC.

Here is the same command with the same scaling options Plex uses:

ffmpeg -codec:0 hevc -i "/raid/film/dvr/Watchmen (2009)/Watchmen (2009).mkv" -filter_complex "[0:0]scale=w=min(720\,iw):h=min(576\,ih):force_original_aspect_ratio=decrease,format=pix_fmts=yuv420p|nv12[0]" -map "[0]" -codec:0 libx264 -crf:0 16 -maxrate:0 6462k -bufsize:0 12924k -r:0 25 -preset:0 veryfast -level:0 4.2 -x264opts:0 "subme=2:me_range=4:rc_lookahead=20:me=hex" -map 0:1 -codec:1 copy -copyts -y -nostats -t 60 /tmp/movie2.mkv

To my surprise this also results in 720x576 pixels in the transcoded file. The mediainfo results are identical to those without the scaling options, and mkvinfo says:

|  + Video track
|   + Pixel width: 720
|   + Pixel height: 576
|   + Interlaced: 2
|   + Display width: 16
|   + Display height: 9
|   + Display unit: 3 (aspect ratio)
|   + Video colour information
|    + Horizontal chroma siting: 1
|    + Vertical chroma siting: 2
|  + CodecPrivate, length 45 (h.264 profile: High @L4.2)

I have imported this file into Plex and played it from Plex on my Chromecast. Since no transcoding is necessary, Plex transmits the full 720x576 resolution to the Chromecast, which reads the intended aspects ratio and shows the file in 16:9 format as intended. This way I get the full resolution of what I recorded.

I’ve spent some time trying to run Plex Transcoder outside of Plex but haven’t succeeded despite LD_LIBRARY_PATH tricks. Still, I can always start the “original” movie in HEVC format inside Plex and display it on a Chromecast so it needs to be transcoded. The command line that Plex used can be seen in my earlier post. The result from mkvinfo on the header file:

|  + Video track
|   + Pixel width: 720
|   + Pixel height: 404
|   + Interlaced: 2
|   + Display width: 718
|   + Display height: 404
|  + CodecPrivate, length 46 (h.264 profile: High @L4.2)

This is “correct” in the sense that it results in a picture of the same display size and proportions as the original movie. It is wrong in the sense that it unnecessarily discards very close to 30% of the original picture information, which could have been kept without upscaling.

Correctamundo!