iv-org / invidious

Invidious is an alternative front-end to YouTube
https://invidious.io
GNU Affero General Public License v3.0
16.04k stars 1.77k forks source link

[Bug] Auto-generated subtitles no longer display in the video player #4660

Open DUOLabs333 opened 4 months ago

DUOLabs333 commented 4 months ago

Describe the bug Even though a particular language is selected in the video player's "Caption Settings" menu, no captions are displayed. This is only an issue with auto-generated subtitles

Steps to Reproduce

  1. Go to any video with auto-generated captions (eg, https://youtube.com/watch?v=l-nMKJ5J3Uc).
  2. Go the the player's "Caption Settings"
  3. Click on "english (auto-generated)"
  4. Notice that there are no subtitles.

Logs

Screenshots

Additional context Note that /api/v1/captions/l-nMKJ5J3Uc?label=English%20(auto-generated) returns

WEBVTT
Kind: captions
Language: en
DUOLabs333 commented 4 months ago

I want to look into this --- does anyone know what URL Invidious uses to fetch the caption?

syeopite commented 4 months ago

It depends on whether the instance has the configuration option use_innertube_for_captions enabled.

The default endpoint Invidious uses is rate-limited on larger instances resulting in broken subtitles as Invidious is unable to fetch the captions from YouTube.

When the workaround use_innertube_for_captions is enabled though, Invidious utilizes YouTube's InnerTube transcript API as a workaround to generate captions. Said API is not ratelimited.

In this particular case, it seems like the bug is caused by your Invidious not enabling the workaround. If you try to view the auto generated caption on https://iv.nboeck.de (an instance with the workaround enabled) you'll see that the captions does show.

DUOLabs333 commented 4 months ago

Interesting --- I'll try that. However, my instance isn't large --- I'm the only one that uses it, and I rarely watch more than 2-3 videos on it per day, which shouldn't be enough for a rate-limit.

csmith1210 commented 4 months ago

I'm also experiencing this on my single user self-hosted instance. use_innertube_for_captions has fixed this, but should this now be enabled by default if the current default is no longer returning captions?

DUOLabs333 commented 4 months ago

use_innertube_for_captions works for me too (I previously had it at the wrong level of indentation).

syeopite commented 4 months ago

I just did some testing.

It seems like YouTube changed something on the regular timedtext endpoint... manually-created captions still work but auto-generated captions are completely broken when not using the workaround.

Although, I'm not even sure if the auto-generated captions has ever actually worked in Invidious... There's been a feature request for YouTube's automatically translated captions for years now. See #2187 and automatically-generated untranslated captions probably also falls into that same category.

LittleAmpton commented 4 months ago

Auto-generated captions definitely worked at least a month ago because I've been using them regularly, and I never had the innertube option set.

Matias314 commented 4 months ago

I've tried setting use_innertube_for_captions: true in both docker-compose.yml and /config/config.yml yet the auto generated subtitles still don't work. Am I missing something?

DUOLabs333 commented 4 months ago

@Matiasgroen Did you make sure the line was at the outermost level (ie, there should be no indentation between the beginning of the line, and option)?

Matias314 commented 4 months ago

In config.yml there is no indentation and in docker-compose.yml it's indented on the same level as the other Invidious config options. Which file should I use anyway?

DUOLabs333 commented 4 months ago

I use config.yml.

AceDenghar commented 4 months ago

Hi,

In my instance adding use_innertube_for_captions works for originals integrated subtitles but not for auto-generated ones.

(Sorry for my english).

stonerl commented 4 months ago

@AceDenghar & @Matiasgroen make sure the indentation is correct:

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: invidious-db
      user: invidious-db
      password: password
      host: invidious-db
      port: 5432
    check_tables: true
    external_port: 443
    domain: my-domain.org
    https_only: true
    statistics_enabled: false
    captcha_enabled: false
    registration_enabled: false
    admins: ["admin"]
    use_pubsub_feeds: true
    enable_user_notifications: false
    use_innertube_for_captions: true
    hmac_key: "change-me"
    default_user_preferences:
      autoplay: true
      quality: hd720
      vr_mode: false
      default_home: <none>
      feed_menu: ["Subscriptions", "Playlists"]
      comments: ["youtube", ""]
      save_player_pos: false
AceDenghar commented 4 months ago

Damn ! @stonerl you're right !

I set it in default_user_preferences section wich was wrong.

Now, with the right indentation it's working well.

Sorry for mistaking and thank you very much !