HEVC hard to play?

Hello,

I noticed yesterday that my Plex Media Server had a hard time transcoding a movie file in HEVC format (specs: see below).
It’s the first time I noticed that my server was stuttering and CPU continue at 100 %.

I tried to play the file directly on a RPI3 with kodi, but here also problems (movie not playing smooth)
Finally played on a PC with VLC. Even here CPU was high and I noticed stuttering.

All clients connect wired on Gbit network, so this is not the problem.

Is this codec so hard to play?

Kind regards,
Bart

General
Format : Matroska
Format version : Version 4 / Version 2
File size : 1.14 GiB
Duration : 1h 31mn
Overall bit rate : 1 781 Kbps
Writing application : Lavf57.25.100
Writing library : Lavf57.25.100 / Lavf57.25.100

Video
ID : 1
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main@L4@Main
Codec ID : V_MPEGH/ISO/HEVC
Width : 1 920 pixels
Height : 816 pixels
Display aspect ratio : 2.35:1
Frame rate mode : Variable
Original frame rate : 23.976 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Writing library : x265 1.9+107-5dbd6a0c8e17:[Linux][GCC 5.3.1][64 bit] 8bit+10bit+12bit
Encoding settings : wpp / ctu=64 / min-cu-size=8 / max-tu-size=32 / tu-intra-depth=1 / tu-inter-depth=1 / me=1 / subme=2 / merange=57 / no-rect / no-amp / max-merge=2 / temporal-mvp / no-early-skip / rdpenalty=0 / no-tskip / no-tskip-fast / strong-intra-smoothing / no-lossless / no-cu-lossless / no-constrained-intra / no-fast-intra / open-gop / no-temporal-layers / interlace=0 / keyint=250 / min-keyint=23 / scenecut=40 / rc-lookahead=20 / lookahead-slices=5 / bframes=4 / bframe-bias=0 / b-adapt=2 / ref=3 / limit-refs=3 / no-limit-modes / weightp / no-weightb / aq-mode=1 / qg-size=32 / aq-strength=1.00 / cbqpoffs=0 / crqpoffs=0 / rd=3 / psy-rd=2.00 / rdoq-level=0 / psy-rdoq=0.00 / no-rd-refine / signhide / deblock / sao / no-sao-non-deblock / b-pyramid / cutree / no-intra-refresh / rc=crf / crf=23.5 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / ipratio=1.40 / pbratio=1.30
Language : English
Default : Yes
Forced : No
Statistics Tags Issue : mkvmerge v9.0.1 (‘Obstacles’) 64bit 2016-04-20 12:48:41 / Lavf57.25.100
FromStats_BitRate : 8706414
FromStats_Duration : 01:31:54.822000000
FromStats_FrameCount : 132223
FromStats_StreamSize : 6001767716

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : A_AAC
Duration : 1h 31mn
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Frame rate : 46.875 fps (1024 spf)
Compression mode : Lossy
Writing library : Lavc57.24.102 aac
Language : Dutch
Default : Yes
Forced : No
Statistics Tags Issue : mkvmerge v9.0.1 (‘Obstacles’) 64bit 2016-04-20 12:48:41 / Lavf57.25.100
FromStats_BitRate : 1508999
FromStats_Duration : 01:31:54.698000000
FromStats_FrameCount : 517001
FromStats_StreamSize : 1040206012

Text
ID : 3
Format : ASS
Codec ID : S_TEXT/ASS
Codec ID/Info : Advanced Sub Station Alpha
Compression mode : Lossless
Writing library : Lavc57.24.102 ass
Language : English
Default : Yes
Forced : No
Statistics Tags Issue : mkvmerge v9.0.1 (‘Obstacles’) 64bit 2016-04-20 12:48:41 / Lavf57.25.100
FromStats_BitRate : 62
FromStats_Duration : 01:27:17.713000000
FromStats_FrameCount : 1022
FromStats_StreamSize : 40338

Menu
00:00:00.000 : :00:00:00.000
00:14:42.799 : :00:14:42.799
00:24:22.628 : :00:24:22.628
00:30:46.470 : :00:30:46.470
00:43:57.093 : :00:43:57.093
00:56:47.779 : :00:56:47.779
01:06:02.792 : :01:06:02.792
01:27:27.993 : :01:27:27.993

yes hevc is harder to play than h.264

so what do you recommend: recode the file? Or are there other settings that can influence this?
Has somebody experience with hardware needed on server to transcode this without to much issues?
When on RASPLEX, my server gets 100CPU.No problem, but video is stuttering
When on WINDOWPHONE with app, same CPU usage, but video is still playing (lower resolution)

Is it possible to influence this behavior from within RASPLEX? Select resolution/bitrate? Other settings on server?

regards,
B

@bart.plessers said:
so what do you recommend: recode the file? Or are there other settings that can influence this?
Has somebody experience with hardware needed on server to transcode this without to much issues?
When on RASPLEX, my server gets 100CPU.No problem, but video is stuttering
When on WINDOWPHONE with app, same CPU usage, but video is still playing (lower resolution)

Is it possible to influence this behavior from within RASPLEX? Select resolution/bitrate? Other settings on server?

regards,
B

Run it through cayars python script. search the forums for cayars thread and check out his 1st post. it will convert to h.264 with 256 2.0 aac in a .mp4 container with the moov atom, probably the most direct playable file ever.

Yes, HEVC is more difficult to deal with. My i5-3570S with transcoder set to “prefer higher-quality” will transcode 1080p HEVC to H264 at around 1.5x realtime. H264->H264 is typically transcoded at around 2.5x. The usual “2000 cpu benchmark per 1080p transcode” doesn’t apply to HEVC material…you’ll probably need 3000-3500 for each HEVC 1080p transcode.

The easiest way to play it would be to just use the optimizer. Using the “Optimize for TV” will transcode it to H264, and also pass through the 5.1 AAC, if I remember correctly. You’ll just need to make sure that your client then selects the optimized version. Some clients have issues deciding between HEVC originals and H264 optimized versions because the optimized versions often end up with a higher bitrate.

Hi @DFury
It’s a Intel Core 2 Duo CPU E8400@ 3.00GHz
Not a modern machine, but it did the job for me past years…

I’m just wondering why this HEVC format uses so much resources. Even playing in on a new laptop, it consumes 30%cpu in VLC.
Is this normal, or is there something wrong with the file…?

h.264 has been around long enough that most devices have hardware specifically dedicated to decoding it, so it doesn’t tax the CPU. HEVC hasn’t been around long enough to have dedicated hardware on even newer devices, so the CPU has to do all that work itself. New hardware with HEVC decoders will happen eventually, but for now, HEVC will pretty much peg any CPU you try to decode it on.

I don’t have any reason to think that there’s anything wrong with the file. Like camnchair mentioned…it’s a new codec, so devices generally aren’t optimized to play it. I have quite a bit of HEVC material now, but I also have to Roku 4’s that can direct-play HEVC. Works great…but it is pretty taxing on my server when I try to play the HEVC stuff on my Roku 3’s (which don’t have HEVC support). What you describe is to be expected given the capabilities of your CPU (passmark score of 2178)…which is right at the recommended score for 1x 1080p transcode from H264 material. As I mentioned before, however, HEVC material requires significantly more CPU. Probably more than your CPU can provide,

I’d definitely recommend utilizing the optimizer to pre-build a direct-playable version.

ok, thanx a lot for clearing this out for me!
B

@bart.plessers said:
I’m just wondering why this HEVC format uses so much resources. Even playing in on a new laptop, it consumes 30%cpu in VLC.
Is this normal, or is there something wrong with the file…?

This new codec doesn’t achieve its bigger compression efficiency by magic. It makes the computer decoding the video work harder.
(And let’s not talk about encoding HEVC, that has even higher cpu requirements.)

With HEVC transcoding on a Core2Duo you won’t achieve Plex-happiness.
This requires serious cpu power.

And the Raspberry Pi cannot decode HEVC, it has only a hardware decoder for AVC.
No way, its ‘smart phone class’ cpu could decode full HD HEVC in software…

just one last question:
I am converting the file with handbrake now


CLI Query: -i “N:\MEDIA\INPUT.mkv” -t 1 --angle 1 -c 1-8 -o “N:\MEDIA\OUTPUT.mp4” -f mp4 -O --decomb -w 1920 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -a 1 -E copy:aac -6 none -R Auto -B 0 -D 0 --gain 0 --audio-fallback ac3 --subtitle 1 --markers=“C:\Users\pless\AppData\Local\Temp\Safety First The Movie (2015)-1-chapters.csv” --encoder-level=“4.1” --encoder-profile=high --verbose=1

To convert the move of 1h30, it will take 4h30 on a Intel Core i5 CPU M560@2.67Ghz.
Is this normal???

grtz
B

You should really adapt the handbrake parameters to the source video.

Your source video is progressive, so you don’t need the ‘decomb’ filter. It just adds more processing time plus it may degrade video quality sometimes.

Your source video is also not anamorphic. Only use the ‘anamorphic’ option with source videos which are actually anamorphic. Otherwise the plex transcoder may kick in at playback time unnecessarily (under some circumstances).

I am not that familar with handbrake’s CLI options, which ‘speed’ setting did you use? This has a great influence on encoding time.
Higher compression efficiency = slower encoding time = smaller file
^^^ this is exactly what the plex transcoder doesn’t do. It defaults to “quick” (and dirty) :wink:

Hello @OttoKerner . I’m not an expert either :slight_smile:
Just used the GUI with “high profile”

The speed parameter is called ‘x264 Preset’ and is set to ‘medium’ in your screen shot.
So it’s set to the default. I’m not sure that an encoding time of 3x playback time is a typical on this cpu.
My i7 would take significantly less.
But just try to disable the two options I mentioned, Maybe this helps already to reduce encoding time.
And Handbrake may be written to behave ‘nice’. Meaning if another software runs in parallel on the same computer, Handbrake will dial its computing cycles back and grant other software precedence. This prolongs encoding time of course.

The two options I was referring to are on the ‘Filters’ and the ‘Video’ tab.
Decomb is on ‘Filters’. Set the dropdown under the ‘Decomb’ radio button to ‘off’.
‘Picture’ has the ‘Anamorphic’ option. Set the dropdown to ‘None’

Both these options are usually only needed when dealing with OTA recorded video or DVD rips. But careful: not all DVD have interlaced video. So I recommend you check alway the source video file with mediainfo and pick the options in Handbrake accordingly.

Unfoirtunately, there is no ‘magic bullet’ and no set of options that works with all video files.

I agree with @danjames92 . Try Cayars script. I use it regularly now to convert video.

@astrofisher, @danjames92: thanx a lot for the tip. Long time ago I played with HandBrake CLI and all it settings. Drove me nuts. Cayars script running now, I will see what output is tomorrow

@OttoKerner: I will give this Cayars script a try. The output of Handbrake of yesterday was useless :frowning:
File wouldn’t play, and info (generated by MediaInfo)
General
\Safety First The Movie (2015).mp4
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42 (isom/iso2/avc1/mp41)
File size : 1.48 GiB

Nothing else

cu tomorrow!
B

@astrofisher, @danjames92 , @OttoKerner : Sorry guys to come back so lately.

Finaly coverted my file with Cayars script.
Result: see below.

File is playing well now on plex, but size 1 Gb --> 2;7 Gb.
Even without any audio track, it still was 2Gb.

Is this a normal ratio?

Also: conversion took 7h30 on a Intel i5 2;67Ghz. Is this normal?

I never had this long conversion times with HandBrake (but never transcoded a x265 either…)

many thanx for your comments!
B

General
Complete name : N:\MEDIA\FILM\KINDEREN_NEW\Safety First The Movie (2015)\safety.first.the.movie.2015.1080p.bluray.6ch.hevc.x265.rmteam.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 2.54 GiB
Duration : 1h 31mn
Overall bit rate : 3 961 Kbps
Writing application : Lavf56.33.101

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings, CABAC : Yes
Format settings, ReFrames : 5 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1h 31mn
Bit rate : 3 055 Kbps
Width : 1 920 pixels
Height : 816 pixels
Display aspect ratio : 2.35:1
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.081
Stream size : 1.96 GiB (77%)
Writing library : x264 core 146 r2538 121396c
Encoding settings : cabac=1 / ref=5 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=8 / 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=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Menus : 0

Audio #1
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 1h 31mn
Bit rate mode : Constant
Bit rate : 256 Kbps
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 : 168 MiB (6%)
Language : Dutch
Default : Yes
Alternate group : 1
Menus : 0

Audio #2
ID : 3
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : ac-3
Duration : 1h 31mn
Bit rate mode : Constant
Bit rate : 640 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Frame rate : 31.250 fps (1536 spf)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 421 MiB (16%)
Language : Dutch
Default : Yes
Alternate group : 2
Menus : 0

Menu

@bart.plessers said:
File is playing well now on plex, but size 1 Gb → 2;7 Gb.
Even without any audio track, it still was 2Gb.
Is this a normal ratio?

for a fullHD picture, this is still relatively small.

Also: conversion took 7h30 on a Intel i5 2;67Ghz. Is this normal?
I never had this long conversion times with HandBrake (but never transcoded a x265 either…)

Same here. I never attempted to transcode a HEVC video. Maybe Handbrake doesn’t have a very good optimized HEVC decoder.

IIRC it took 4 or 5 hours to convert on my PC - i3-4150 CPU @ 3.50GHz