theothernt / AerialViews

A screensaver for Android TV devices including Nvidia Shield, Fire TV, and Chromecast with Google TV. Inspired by Apple TV's video screensaver.
GNU General Public License v3.0
415 stars 32 forks source link

Videos playing not smoothly #123

Closed jmlugones closed 7 months ago

jmlugones commented 8 months ago

Hello. First of all, thank you, the app is great. I have it on four devices, only one does it not work perfectly. Works perfect on Fire TV Stick (3rd generation) and Chromecast 4K. I only find a problem on a TCL TV with Android TV 9. The TV is 1080p with HDR 10. But the interface works in 720p SDR 8. The screensavers work but not fluidly. It happens with all of the Apple ones and only some from other sources. Most from other sources work perfectly. If I disable hardware acceleration, it runs worse, so that's not it. With the fix for Phillips it makes no difference. I can't think of what the problem could be. It may be some issue between the GPU and Apple's H.265 codec, but the Apple TV+ app works fine. Another may be that a 1080p video plays in 720p. This does not happen with videos that are played in 1080p 8-bit in SDR content, and in 10-bit in HDR content. The TV automatically adjusts this. The TV doesn't support Dolby Vision nor 4K, the setting are in 1080p HEVC. The problem happens also in 1080p H.264. I'm not asking for it to be fixed, it doesn't bother me. I am only reporting the error for development information.

theothernt commented 8 months ago

Ok, so lets go through a few things to try and narrow down the issue...

  1. The TCL TV, running Android TV 9 has the issue - can you get the model so I can do some more research?
  2. The Philips fix only relates to codec/video type identification so I won't do anything on non-Philips TVs 😅
  3. To confirm, you have the issue with 1080p H.264 and 1080p HEVC?
  4. Would it be possible to download a couple of videos to try and play them locally or from a USB device?

Also, with all streaming services (Netflix, Disney, etc) they have movies in many formats for different devices to ensure smooth playback. The videos I use from Apple were not originally for any non-Apple TV device although they work fine - mostly. Also, I have an old 2015 Sony Android TV to test on and the 1080p HEVC videos play fine, so it's an odd issue.

jmlugones commented 8 months ago

1) The model is RCA AND42Y (RCA is a third world manufacturer). It is a copy of TCL L42S6500 (Board: RTD2841). CPU: ARMv8-A Cortex-A53 4x @ 900 MHz (32 bits mode) / GPU: Mali-470 MP / RAM: 1.5 GB

2) Ok. I tried, just in case.

3) The issue happens with Apple videos 1080p H.264 and 1080p HEVC, and with Robin Fourcade 1080p H.264 and 1080p HEVC. Jetson Creative videos works fine with 1080p H.264 and 1080p HEVC. I can't test the 4K or Dolby Vision, because the TV doesn't support them.

4) Sure. I have SMB in my PC and the TV have USB Port.

5) I have Netflix, Prime Video, HBO Max, Apple TV, Star, Disney, Paramount, Pluto, YouTube, and other local streaming apps. They work fine. I think it may be an issue between the hardware decoding of this GPU and the codec settings used by Apple and Robin Fourcade videos. Sometimes a few adjustments, such as references frames, can make a difference in differents hardware. In that case it is not advisable to re-encode the videos. I simply disable those screensavers and that's it.

Thanks. Bye.

jmlugones commented 8 months ago

I checked with MediaInfo the format of the three types of videos, they are the same. Except the profile and level. But the ones that work, are in high profile and a higher level than the others, so the others should work. The exact settings are only listed in the Jetson videos because they were encoded with x265, the others do not contain that information.

Apple Format Profile: HEVC 1080p 30 FPS 10 bits (Main 10@L4@Main) Robin Format Profile: HEVC 1080p 30 FPS 10 bits (Main 10@L4.1@Main) Jetson Format Profile: HEVC 1080p 30 FPS 10 bits (Main 10@L5.2@High)

The complete x265 settings from Jetson are:

cpuid=1049583 / frame-threads=3 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1920x1080 / interlace=0 / total-frames=0 / level-idc=52 / high-tier=1 / uhd-bd=0 / ref=3 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=25 / keyint=250 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=20 / lookahead-slices=6 / scenecut=40 / hist-scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / 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=1 / no-limit-modes / me=1 / subme=2 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=3 / selective-sao=4 / early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=24.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / vbv-maxrate=12000 / vbv-bufsize=240000 / vbv-init=0.9 / crf-max=0.0 / crf-min=0.0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / 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=1 / transfer=1 / colormatrix=1 / 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 / decoder-max-rate=0

But there is no information from the others to compare.

theothernt commented 8 months ago

Thanks for that info - the strangest part is being unable to play the H.264 clips smoothly. The weakest device on the market, as far as I know is, the original Fire TV stick (1st gen) which can't even decode HEVC.

I will do a bit of research and see if there are any options I can change within ExoPlayer to give you smooth playback.

My only guess, so far, is that ExoPlayer is not using hardware decoding. If you'd like to debug the issue a bit more, I can make a debug version of the app which will output more info about the playback status but will need a PC or Mac to connect to the device and capture logs.

The other option is to download only the videos that play smoothly, then ignore the rest?

EDIT: also, what codecs are listed on the Settings > Device capabilities ?

jmlugones commented 8 months ago

It's definitely very strange. This television was manufactured in 2020. If you want, you can send me the APK of the app in debug mode and I will send you the reports. But I repeat, it is not a problem for me. Disabling Apple and Robin videos work perfectly. And it's only on this TV, I have three other TVs in my home that all the videos work perfectly.

In Device Capabilities it shows the following:

[Device] Model: TCL UnionTV Android: v9

[TV/Display] Supports HDR10: Yes Supports Dolby Vision: No

[Codec Summary] AVC: Found HEVC: Found Dolby Vision: Not Found

[Video Decoders] OMX.realtek.video.decoder, OMX.realtek.video.decoder.secure, OMX.google.h264.decoder, OMX.google.hevc.decoder

[Resolution] UI resolution: 1280x720 @ 60.00hz Max. video resolution: 1920x1080 @ 60.00hz

jmlugones commented 8 months ago

I'm sending you a video in 720p so it's not too heavy. It doesn't show up very well on camera, but there is a lag in Apple and Robin's videos. I forgot to disable the Phillips fix but it is the same on or off.

https://cutt.ly/uwRj77Re

theothernt commented 8 months ago

Thanks for the video and running those tests. With the Apple videos, I can clearly see the stuttering/jerkiness!

Let me put together a debug build that outputs extra info. My guess is that it'll confirm that hardware acceleration is being used, in which case there's not much I can do - but it'll be good to confirm it either way.

Unrelated to this, but I have seen movies encoded with HEVC Main 10 not play properly on Android - they had similar stuttering. The only solution was to re-encode or find another version.

If you have time, can you try playing one of the video files with Just Player (it's free on the Play Store). It uses the same internal player (Google's ExoPlayer) as Aerial Views and could help to narrow things down a bit.

jmlugones commented 8 months ago

Hello. Sorry for the delay. I downloaded an Apple video to a USB. I tried the Just Player app, and the same thing happens. Just in case, I checked with MX Player in both HW Decoder and HW+ Decoder, and the same. So it is confirmed that it is not a bug in Aerial Views or ExoPlayer, but a specific error between the hardware decoding of this model and the specific format that Apple uses in those videos. Many times I watched 10-bit x265 videos in MX Player and they play fine. So anyway it's not a bug or something fixable. Thank you.

theothernt commented 8 months ago

Thanks for doing all that work. So it seems to be an issue with Realtek video decoders and certain video formats.