Jump to content

HEVC x265 playback issue


foleys

Recommended Posts

foleys

I'm experiencing three distinct playback issues with certain HEVC content. I have lots of various HEVC content, but only certain videos are causing problems.

 

Problem 1: The best way I can describe it is a skip or jump. 99% of the video plays normally, but every so often a few frames will be skipped/dropped so it looks like the video jumps ahead a couple seconds. I can rewind, fast-forward, pause, resume, stop, restart, but the skips always seem to occur at the same times in a particular video. The skip can be very noticeable and jarring depending on the amount of motion in the current scene. The audio plays perfect and always remains in sync.

Players/clients tested to exhibit the issue: Fire TV Cube (2nd gen), Fire TV (3rd gen)

I have not tested all videos, but thus far the videos appear to play normally on these players/clients: Fire TV Stick 4K, nvidia Shield TV (2017 version)

 

Problem 2: Most videos freeze during the first 10 seconds, making it seem as though the video is not going to play, but then it does start playing without intervention. The audio plays perfect while the video is frozen.

Players/clients tested to exhibit the issue: Fire TV Cube (2nd gen), Fire TV (3rd gen), Fire TV Stick 4K, nvidia Shield TV (2017 version)

 

Problem 3: The same videos being played on my Android phone (Pixel 2 XL) are extremely choppy to the point of being unwatchable. The audio plays perfect, but becomes way out of sync because the video is so lagging.

 

In all scenarios the three issues are present only with DirectPlay, the videos play perfect if I make config changes to force an h264 transcode.

All videos play perfect in VLC on a Windows computer.

 

 

General
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 2.03 GiB
Duration                                 : 2 h 10 min
Overall bit rate                         : 2 231 kb/s
Writing application                      : Lavf58.20.100
 

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L4@Main
Codec ID                                 : hev1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 2 h 10 min
Bit rate                                 : 2 000 kb/s
Width                                    : 1 918 pixels
Height                                   : 1 036 pixels
Display aspect ratio                     : 1.85:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.042
Stream size                              : 1.82 GiB (90%)
Writing library                          : x265 3.3+4-rarbg-30eb4de83092:[Linux][GCC 8.3.1][64 bit] 10bit
Encoding settings                        : cpuid=1111039 / frame-threads=4 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1918x1036 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=23 / keyint=250 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / hist-scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / no-sao / no-sao-non-deblock / rd=4 / selective-sao=0 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=abr / bitrate=2000 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=2 / cplxblur=20.0 / qblur=0.5 / ipratio=1.40 / pbratio=1.30 / aq-mode=3 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=2 / transfer=2 / colormatrix=2 / chromaloc=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / hist-threshold=0.01 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / no-scenecut-aware-qpconformance-window-offsets / right=0 / bottom=0
Encoded date                             : UTC 2020-04-18 09:57:14
Tagged date                              : UTC 2020-04-18 09:57:14
 

  • Like 2
Link to comment
Share on other sites

foleys

As I understand it, and please correct me if I'm wrong, but an ffmpeg log is only written when transcoding? My issues only exist when using DirectPlay. Do I need to enable debug logging?

I'm attaching my embyserver.txt log file.

embyserver.txt

Link to comment
Share on other sites

foleys

I found some active discussions on the plex forums regarding this same issue. One of the reports was specific to the AppleTV client/player, but a change to the external Infuse video player fixed the problem.

https://forums.plex.tv/t/example-of-stuttering-hevc-playback-on-apple-tv-4k/558255

https://forums.plex.tv/t/some-x265-files-stutter-on-android-mobile/566223/9

https://forums.plex.tv/t/hevc-main-10-1080p-stuttering-on-roku-ultra/563984

Link to comment
Share on other sites

daedalus

Problem 3: The same videos being played on my Android phone (Pixel 2 XL) are extremely choppy to the point of being unwatchable. The audio plays perfect, but becomes way out of sync because the video is so lagging.

 

 

i'm seeing something similar on the xiaomi mi 8 lite android 10

 

all my HEVC (sdr, hdr, 8 bit, bt709, 10bit, bt2020) files stutter in emby with high CPU usage, while all these play perfectly fine with GPU decoding in other players like vlc (direct and as external player in emby)

Link to comment
Share on other sites

foleys

FWIW, I was able to remux to mkv with MKVToolNix version 45 and the resultant file plays perfect in all players/clients, including my phone which was the worst. Any version prior to 45 made the situation much worse though, so it seems they identified and fixed something in 45.

Link to comment
Share on other sites

pwhodges

Curious.  I've not noticed any HEVC problems with previous releases, so I wonder why it's changed for you. 

 

I've sometimes had audio seriously out of sync on my Android (Huawei MediaPad 5), but that's always been fixed for a week or two by rebooting the Android.

 

Paul

Edited by pwhodges
Link to comment
Share on other sites

daedalus

FWIW, I was able to remux to mkv with MKVToolNix version 45 and the resultant file plays perfect in all players/clients, including my phone which was the worst. Any version prior to 45 made the situation much worse though, so it seems they identified and fixed something in 45.

 

great yours is fixxed

 

badly it does not change anything on my situation

Link to comment
Share on other sites

foleys

great yours is fixxed

 

badly it does not change anything on my situation

 

I probably should have been more clear in my posting, I have no intention of remuxing all my mp4 hevc content into an mkv container, I was just experimenting with one file. So all of my previously explained issues still exist.

Link to comment
Share on other sites

foleys

Hello,

Is there any further info I can provide to help resolve these issues?

Thanks again!

Link to comment
Share on other sites

levelhead1us

@@foleys How do you "make config changes to force an h264 transcode" ?

 

For me the problem (Samsung TV has trouble decoding some hevc content quickly enough) seems to be happening specifically on titles that were encoded using libeblm v1.3.5 + libmatroska v.1.5.2 (not sure if it's the combination or just libeblm; 1.3.9/1.5.2 combo seems fine). You can check the encoder using ffprobe. I'm sure it's the player / hw combo on the tv. It would be nice to just force these to transcode somehow (using the player options is no good --  I have to push it all the way down to 720p 1.5Mbs and quality is horrible). I'm sure issues like this are going to crop up a lot as the TV software is not getting updated as fast as the libraries we're using for encoding.

Edited by levelhead1us
Link to comment
Share on other sites

levelhead1us

I did a little bit more debugging and I've found out what my problem is. If a video has more than 32 streams (video+audio+subtitles), it causes problems with the player (at least with the Tizen AV Player on samsung). It's not specific to the encoder versions I mentioned above -- I can see the problem when it was encoded with older libraries too.

 

It's tricky to nail down because **sometimes** it gets transcoded to h264 (have to look at the nerd stats to see this). Something is flaky about when it decides to transcode because I've rebooted the TV and the same file that got transcoded last time will try to direct play and start skipping. Anyway, that's for the devs. 

 

If your having an issue like this and your device is direct playing, check out the # of streams:

# ffprobe <filename> 2>&1 | grep Stream

Combine that with a little shell trickery and it's straightforward to find all the files that have the problem.

 

An easy workaround until (if ever) there's a general fix is to remake the file with ffmpeg using stream copying. The following will just copy the default stream of each type and skip over all other streams:

# ffmpeg -i <input_file> -c copy <output_file>

 

Edit: corrected ffprobe command

Edited by levelhead1us
Link to comment
Share on other sites

foleys

By "config changes", I mean adjusting the client playback video quality settings. But as you mentioned, I also have to lower them so much that the resultant quality is horrible.

My video files only have 2 streams, were encoded with Lavf58.20.100, and are mp4 not mkv.

Link to comment
Share on other sites

levelhead1us

Sorry to hear it's not the same problem. You might look at the complete ffprobe output and see if there's something you can notice that different about the files that play fine vs. ones that don't. I just happened to see the problem between one season and then next of a series I was binging so the that's how I finally got to the bottom of it.

Link to comment
Share on other sites

dethknite

I have had weird issues that started about 3 weeks ago with playback (most likely x265 as that is what I am running stuff through handbrake with). This is occurring with media that previously played fine, but now, will playback for a few minutes, then has to rebuffer/lags on roku, or will simply not start on chrome and the ffmpeg.exe will peg the cpu at 100%. I captured both of these transcodes and attached. The one that rebuffers/lags, the fps slowly drops from ~190fps to ~10fps. Also to note, it says x264 in the remux playback, but it is clearly encoded in x265 via handbrake.

ffmpeg-transcode-266729ee-8ca0-4622-ad18-9130ea52568f_1.txt

ffmpeg-transcode-39754272-bd3d-46c5-b395-fdbb1d6a52e2_1.txt

Edited by dethknite
Link to comment
Share on other sites

I have had weird issues that started about 3 weeks ago with playback (most likely x265 as that is what I am running stuff through handbrake with). This is occurring with media that previously played fine, but now, will playback for a few minutes, then has to rebuffer/lags on roku, or will simply not start on chrome and the ffmpeg.exe will peg the cpu at 100%. I captured both of these transcodes and attached. The one that rebuffers/lags, the fps slowly drops from ~190fps to ~10fps. Also to note, it says x264 in the remux playback, but it is clearly encoded in x265 via handbrake.

Just for testing purposes, if you disable the transcoding throttle feature, does that have any impact?

  • Like 1
Link to comment
Share on other sites

dethknite

Just for testing purposes, if you disable the transcoding throttle feature, does that have any impact?

 

That stopped the issue with the restarting. Weird that it started up recently as that has been set for a long time. I will just keep it off and let the transcodes go full cpu when necessary (used to have ffmpeg processes that continued sometimes after a user stopped watching mid-flight unecessarily using cpu. I do not know if this issue still occurs, but I never saw it after the throttling).

 

Thanks for pointing me in the right direction.

Edited by dethknite
Link to comment
Share on other sites

Also anytime you have a problem such as this, the first thing you should try is setting transcoding customizations back to defaults:

>>>>>  Non-Default Encoder Parameters
Warning EncoderParametersH264LibX.ConstantRateFactor: Original: 23 Actual: 22
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
foleys

Just checking in to see if any movement has been made on these issues?

Any help or additional debug info I can provide?

 

Link to comment
Share on other sites

foleys

I see responses to others posts, but not my original question. Unless I'm missing something?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...