lamarios / clipious

Invidious client for android
GNU Affero General Public License v3.0
929 stars 31 forks source link

Can't play DASH on Android 7 and without DASH highest quality is 360P #559

Closed ThaDaVos closed 6 days ago

ThaDaVos commented 3 months ago

Describe the bug A clear and concise description of what the bug is.

As mentioned here: https://github.com/lamarios/clipious/issues/514 I am still experiencing issues with Clipious after the Invidious fix for https://github.com/iv-org/invidious/issues/4498 Checking their fix, it should not have broken anything as it's an API call fix - but for some reason, Clipious is heavily broken on my Nvidia Shield K1 tablet with Androind 7 - strange thing is, it is only broken on that single device, my phone with Android 13 is working fine without issues.

As the mentioned issues seems to go unnoticed - I am creating this issue to track it as Clipious is the only well working client for Androidn in my opinion.

Currently I am going through the code myself, checking where it may be getting stuck - currently checked the logs on both devices and they both seem to have the exact same log for the exact same video - but the Android 7 device just won't start playing the video. If i set it to audio only I can hear it play at least - but the VideoPlayer doesn't wanna work.

Based on the code it seems https://github.com/lamarios/river_player is used - maybe the issue is in there instead as maybe the dash manifest or something has changed because of the changed param in the youtube API call - but I still think this has to be fixed on Clipious or RiverPlayer's side instead of Invidious.

To Reproduce Steps to reproduce the behavior:

  1. On Android 7 Device, try to play a video (maybe it's not Android 7 related but something else, I don't know)

Expected behavior A clear and concise description of what you expected to happen. The video to play

Screenshots If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

ThaDaVos commented 3 months ago

@Alma101 maybe you can leave your device information here too so we can find a common thing between them?

ThaDaVos commented 3 months ago

I think I may have found the issue... https://www.reddit.com/r/Android/comments/1c7i24z/youtube_is_now_forcing_av1_on_every_device/

It seems YouTube is forcing AV1 now - so the MPD contains AV1 as only codec:

<Representation id="299" codecs="avc1.64002a" width="1920" height="1080" startWithSAP="1"
  maxPlayoutRate="1" bandwidth="6509775" frameRate="60">
  <BaseURL>
    https://{INVIDIOUS_INSTANCE}/videoplayback?expire=1719526376&amp;ei=iI99ZtrzKKu46dsPgLOqsA8&amp;ip={IP}&amp;id=o-APptZmsF76T31409U_cMk3jyFTplUYQKr5i0KNIB80HK&amp;itag=299&amp;source=youtube&amp;requiressl=yes&amp;xpc=EgVo2aDSNQ%3D%3D&amp;mh=bP&amp;mm=31%2C29&amp;mn=sn-5hne6ns6%2Csn-5hnekn7s&amp;ms=au%2Crdu&amp;mv=m&amp;mvi=4&amp;pl=20&amp;initcwndbps=1513750&amp;vprv=1&amp;svpuc=1&amp;mime=video%2Fmp4&amp;rqh=1&amp;gir=yes&amp;clen=222717697&amp;ratebypass=yes&amp;dur=303.703&amp;lmt=1719496361239824&amp;mt=1719504308&amp;fvip=3&amp;keepalive=yes&amp;c=ANDROID_TESTSUITE&amp;txp=6309224&amp;sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cvprv%2Csvpuc%2Cmime%2Crqh%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&amp;sig=AJfQdSswRQIhAO1ekkMvd-BDlB_8UFyENJXSd6vSt_HmpuoU3zMK7ZySAiBzToVGBmaISIGCxIIHKQx9XuLdTog5cMA-pa28eQVqtQ%3D%3D&amp;lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&amp;lsig=AHlkHjAwRQIhAMOK5hcEmoBGtXLSSe0X6aCyPhxh4eihazF3IuxLPXfuAiA3KAWDzlFLcmb7lV0MoQ1Nmp_0CvgiGeuzYVnSJU53mg%3D%3D&amp;host=rr4---sn-5hne6ns6.googlevideo.com</BaseURL>
  <SegmentBase indexRange="741-1432">
    <Initialization range="0-740" />
  </SegmentBase>
</Representation>

Guess riverty_player only does hardware decoding so it fails to play @lamarios ?

lamarios commented 3 months ago

Good find. That's probably the issue. I believe most players only do hardware playback.

ThaDaVos commented 3 months ago

Check the issue I made on Invidious side - I think that's the main cause of it - Youtube thinks my tablet is Android 12+ - while it isn't

lamarios commented 3 months ago

Alright. Will subscribe to this issue. See if there's anything that can be done on my side afterwards

ThaDaVos commented 1 month ago

And now it's fully broken... Won't even play 360p anymore... Think I'm gonna dive into Invidious their code now... And change what they say doesn't solve it...

ThaDaVos commented 1 month ago

Can fix it by turning off the redirect/proxy through Invidious option in Clipious though - still 360p sadly and Dash non-functional

lagset commented 1 month ago

Just to confirm: Same issue here. No playback on Android TV and only 360p on my Pixel 8.

ThaDaVos commented 1 month ago

@lagset - please give some device information so we can look for common denominators, for example Android version, Clipious version, invidious version, invidious host (with SSL?) etc

Also, does my workaround work for you too? Disabling the "redirect through invidious" option?

lagset commented 1 month ago

@ThaDaVos Here is some information about the devices/software in use in my setup:

Invidious instance Version: 2024.08.26-4782a67 Hosting: Locally, using latest release docker image, reverse proxy with ssl (using a certificate by a custom root ca, all my devices trust) env vars (changed some private values, marked them with *):

  INVIDIOUS_CONFIG: |
          db:
            dbname: invidious
            user: some-user*
            password: some-user*
            host: invidious-db
            port: 5432
          check_tables: true
          domain: invidious.my.private.domain*
          external_port: 443
          https_only: true
          # statistics_enabled: false
          hmac_key: somekey*

Web-Frontend: Thumbnails work, Playback Works, Playback >720p using DASH works as well

Pixel 8 android version: 14 clipious version: 1.20.0 current behavior: Playback works, but only 360p previous behaviour: playback worked, but only up to 720p; DASH has never worked for me with clipious

Sony Android TV android version: 9 clipious version: 1.17.5 current behaviour: thumbnails work, video playback does not work ("video cannot be loaded") previous behaviour: playback worked but only up to 720p; DASH has never worked for me with clipious

Regarding your workaround: I have never enabled the "redirect through invidious"-option in clipious. It has never worked for me and always gave a "i"-icon on video playback. Same with DASH which I never got to work in clipious but does work with the invidious frontend. I guess this has to do with my setup (custom ssl cert, etc.), there are a bunch of issues/discussions on here struggling with getting DASH running on locally hosted instances.

ThaDaVos commented 1 month ago

Thanks for the info @lagset - sadly I think your issue is different from mine as I had DASH working with 1080 and up - it still works on my phone (android 13) but does not on my tablet (android 7) - I figured out my issue is encoding related or something.

Yours seems to be about DASH itself and partially playback (maybe also encoding)

One thing I noticed is that your Clipious is outdated, have you tried updating it? (Also, use Obtanium for installation and updates, makes it way easier)

Also, try to get DASH working with a Let's Encrypt certificate instead of a custom CA, you can also try enabling the option in Clipious to accept untrusted certificates in server management (I needed that before to get it working at all)

lagset commented 1 month ago

You're probably right. Thanks for the hint to obtanium, makes updating on Android TV way easier!

However, update to current clipious doesn't change anything. No playback currently on Android TV version 9 with clipious 1.20.0.

Offtopic: @ThaDaVos Do you host your instance locally as well? If so, how did you achieve DASH working with clipious, any hints welcome :)

ThaDaVos commented 1 month ago

Let me correct that - I think it's the same issue - just noticed my Android 13 phone also only allows max 360p - but since DASH works on that one, I never noticed...

Also a difference between my phone and tablet is that my tablet needs "TLS-certificate verification skip" (roughly translated as mine is in Dutch) turned on, else it does not work at all, probably because the certificate store is outdated.

But coming back to the issue - DASH used to work on my tablet and suddenly stopped, and now both devices without DASH allow only max 360p - so I guess it has something to do with parsing inside Clipious - when I have time I'll try to create a DEBUG build which allows me to see the received video information etc to debug this better - as it is something which broke after a certain invidious update, something has to have changed there which causes this.

Offtopic: @lagset - I host it locally and am using LetsEncrypt with DNS-ACME to get a wildcard certificate, this certificate is used for my invidious and allows me to use DASH - I also remember it took some configuring on Invidious side to get it working, below is my service definition for Invidious:

services:
  invidious:
    image: ${INVIDIOUS_IMAGE}
    container_name: invidious
    restart: always
    environment:
      # Please read the following file for a comprehensive list of all available
      # configuration options and their associated syntax:
      # https://github.com/iv-org/invidious/blob/master/config/config.example.yml
      INVIDIOUS_CONFIG: |
        db:
          dbname: ${POSTGRES_DB}
          user: ${POSTGRES_USER}
          password: ${POSTGRES_PASSWORD}
          host: postgres
          port: 5432
        check_tables: true
        port: ${INVIDIOUS_PORT}
        external_port: 443
        domain: ${INVIDIOUS_DOMAIN}
        https_only: true
        popular_enabled: false
        captcha_enabled: false
        # statistics_enabled: false
        hmac_key: "${HMAC_KEY}"
        admins: ${INVIDIOUS_ADMINS}
        default_user_preferences:
          default_home: Trending
          player_style: youtube
          quality: dash
          quality_dash: best
          local: true
    healthcheck:
      test: wget -nv --tries=1 --spider http://127.0.0.1:${INVIDIOUS_PORT}/api/v1/comments/jNQXAC9IVRw || exit 1
      interval: 30s
      timeout: 5s
      retries: 2
    logging:
      options:
        max-size: "1G"
        max-file: "4"
    depends_on:
        postgres:
            condition: service_healthy
    networks:
      default:
      home_proxy:
ThaDaVos commented 1 month ago

@lamarios - maybe you can help with getting debug information inside clipious? Like show the received MPD manifest, api calls inside the app in some kind of log screen at the view of the video player - that way it can be easier to diagnose instead of going through the log

lagset commented 1 month ago

Good luck with debugging. Looking forward to any news on this!

Offtopic: Thanks for the tips and your config sample. Will have another try, however let's encrypt is currently not possible for me, since I do not expose my server to the public.

ThaDaVos commented 1 month ago

Good luck with debugging. Looking forward to any news on this!

Offtopic: Thanks for the tips and your config sample. Will have another try, however let's encrypt is currently not possible for me, since I do not expose my server to the public.

Offtopic: I don't expose it either - that's why I mentioned used acme-DNS - this way I only have to set an acme record: https://github.com/joohoi/acme-dns

ThaDaVos commented 3 weeks ago

@lamarios - I got DASH working again by using ZeroSSL certificate instead of Let's Encrypt as they changed their CHAIN earlier this year - still doesn't fix the max resolution is 360P on non-dash though

lamarios commented 3 weeks ago

For the 360p i believe that might be an invidious issue. If i call the api on a video:

https://inv.nadeko.net/api/v1/videos/SurUidVDQf4

if you search for "formatStream" you will see that only 360p is available

ThaDaVos commented 3 weeks ago

For the 360p i believe that might be an invidious issue. If i call the api on a video:

https://inv.nadeko.net/api/v1/videos/SurUidVDQf4

if you search for "formatStream" you will see that only 360p is available

Yeah I saw that earlier, but now it's the problem of finding what causes it

ThaDaVos commented 3 weeks ago

Create a bug report for it, again... https://github.com/iv-org/invidious/issues/4907

ThaDaVos commented 3 weeks ago

It seems there's not solution for it - except getting DASH working: https://github.com/iv-org/invidious/issues/4907#issuecomment-2340187641

lamarios commented 6 days ago

it should be working now since the verson 1.21.0 make use of user install certificates