Using ffmpeg to avoid PLEX transcoding.

ffmpeg -i input.mp4 \
    -c:v libx264 \
    -profile:v high \
    -level 5 \
    -crf 18 \
    -maxrate 10M \
    -bufsize 16M \
    -pix_fmt yuv420p \
    -vf "scale=iw*sar:ih, scale='if(gt(iw,ih),min(1920,iw),-1)':'if(gt(iw,ih),-1,min(1080,ih))'" \
    -x264opts bframes=3:cabac=1 \
    -movflags faststart \
    -c:a libfdk_aac \
    -b:a 320k \
    -y output.mp4

If parts of the file reside on physically bad sectors, or for whatever reason, the OS cannot serve the whole file to FFmpeg try: ffmpeg -err_detect ignore_err -i input.mkv ...

To install ffmpeg:

brew tap varenc/ffmpeg
brew install varenc/ffmpeg/ffmpeg --with-fdk-aac --HEAD

To see more options:

brew options varenc/ffmpeg/ffmpeg