@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.