{"id":13835375,"url":"https://github.com/pierretom/autoselect-forced-sub","last_synced_at":"2025-07-10T07:31:53.769Z","repository":{"id":205438727,"uuid":"712881512","full_name":"pierretom/autoselect-forced-sub","owner":"pierretom","description":"Automatically select forced subtitles in a different way","archived":false,"fork":false,"pushed_at":"2024-04-17T21:10:33.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-05T14:16:12.387Z","etag":null,"topics":["automatic","forced","lua","mpv","mpv-player","mpv-script","script","subtitle"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pierretom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-11-01T11:54:23.000Z","updated_at":"2024-03-01T21:01:12.000Z","dependencies_parsed_at":"2023-12-03T15:22:32.485Z","dependency_job_id":"cd70d86a-13e8-4305-8279-a5113ca67eb7","html_url":"https://github.com/pierretom/autoselect-forced-sub","commit_stats":null,"previous_names":["pierretom/autoselect-forced-sub"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierretom%2Fautoselect-forced-sub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierretom%2Fautoselect-forced-sub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierretom%2Fautoselect-forced-sub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierretom%2Fautoselect-forced-sub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pierretom","download_url":"https://codeload.github.com/pierretom/autoselect-forced-sub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225627370,"owners_count":17498970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automatic","forced","lua","mpv","mpv-player","mpv-script","script","subtitle"],"created_at":"2024-08-04T14:01:00.576Z","updated_at":"2025-07-10T07:31:53.751Z","avatar_url":"https://github.com/pierretom.png","language":"Lua","funding_links":[],"categories":["Subtitle"],"sub_categories":[],"readme":"# autoselect-forced-sub\n\nA Lua script for [mpv](https://mpv.io) to automatically select forced subtitles in a different way.\n\nForced subtitles are a type of subtitle that must be provided in a video just to make it understandable. Such as when a foreign or alien language is spoken, or when a sign or flag is shown.\n\nThe script does not download any subtitles and will also do nothing if no subtitles are available.\n\n## Installation\n\nUse `autoselect-forced-sub.lua` for mpv versions \u003e= 0.37.x ([see here](https://github.com/pierretom/autoselect-forced-sub/tree/mpv-0.36.x) for older versions).\n\nPlace it in the corresponding mpv `scripts` folder of your operating system:\n* Linux \u0026 BSD:\n  - `$XDG_CONFIG_HOME/mpv/scripts` or\n  - `~/.config/mpv/scripts` or\n  - `/home/\u003cusername\u003e/.config/mpv/scripts`\n* macOS:\n  - `$HOME/.config/mpv/scripts` or\n  - `~/.config/mpv/scripts` or\n  - `/Users/\u003cusername\u003e/.config/mpv/scripts`\n* Windows:\n  - `%APPDATA%\\mpv\\scripts` or\n  - `c:\\users\\\u003cusername\u003e\\AppData\\Roaming\\mpv\\scripts`\n\n## Options\n\nThis script uses some [mpv options](#mpv) and its [own options](#script).\n\n### mpv\n\n| Option\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp; | Value | Action\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp; |\n| :------------------------- | :--------------- | :-------------------------------------------- |\n| `track-auto-selection`     | `no`             | Disable this script at startup or at runtime. |\n| `sid` *or* `sub`           | *all but* `auto` | Disable this script at startup only.          |\n| `slang`                    | *optional but __recommended__* | Used to select forced and non-forced subs with the specified language codes. |\n\n#### Notes\n\n1. When setting up `--slang`, for better results, use [ISO 639-1, 639-2/T and 639-2/B codes](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes). The script will try to search the exact code, the order is taken into account, if not found it will try to search the code in character strings.\u003cbr /\u003e\nExamples:\n   * `--slang=ja,jpn,en,eng`\n   * `--slang=es,spa`\n   * `--slang=fr,fra,fre`\n   * `--slang=sq,sqi,alb`\n\n   Multi-component languages are also supported, the following will search for Brazilian Portuguese subtitles then the `por` code. If not found it will search for `pt` then `por` in character strings (e.g. a track with the language `pt-PT`, `pt-AO` or `pt-CV` will match):\n   * `--slang=pt-BR,por`\n\n2. All other mpv options are ignored.\n\n### Script\n\n| Option\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp; | Value | Action |\n| :--------------------- | :--------------- | :-------------------------------------------- |\n| `afs-enable`           | `no`             | Disable this script at startup or at runtime. Default value: `yes`.|\n| `afs-sub_forced_only`  | `yes`            | Select only detected forced subtitles. Default value: `yes`.\u003cbr /\u003eIf no forced subtitles match the language codes specified with `--slang`:\u003cbr /\u003e\u003cbr /\u003e1. The first one that matches the language of the current audio track will be selected.\u003cbr /\u003e2. Otherwise it selects the forced subtitle with the lowest ID. |\n| `afs-sub_forced_only`  | `no `            | Select detected forced subtitles in priority.\u003cbr /\u003eIf not found select another subtitle in that order:\u003cbr /\u003e\u003cbr /\u003e1. First subtitle with the default flag that matches language codes.\u003cbr /\u003e2. First subtitle that matches language codes.\u003cbr /\u003e3. First subtitle that matches the language of the current audio track.\u003cbr /\u003e4. First subtitle with the default flag that not matches language codes.\u003cbr /\u003e5. The subtitle with the first ID. |\n\n#### Notes\n\n1. With `--script-opts=afs-sub_forced_only=no`, you are sure to select one forced or non-forced subtitle track.\n\n#### Examples to set the script options\n\nOptions are read in that order:\n\n##### 1. On the command line\n\n```\nmpv --script-opts=afs-enable=no\nmpv --script-opts=afs-sub_forced_only=no\nmpv --script-opts=afs-enable=yes,afs-sub_forced_only=yes\n```\n\n##### 2. In mpv.conf\n\n```\nscript-opts=afs-enable=yes,afs-sub_forced_only=no\n```\n\n##### 3. In afs.conf\n\nThis file can be placed in the `script-opts` folder (same location as the [scripts](#installation) folder).\n\n```\nenable=yes\nsub_forced_only=no\n```\n\n##### 4. In autoselect-forced-sub.lua\n\nThe options are located at the beginning of the script, below `local our_opts =...`\n\n```\nenable = true\nsub_forced_only = true\n```\n\n##### 5. For key bindings and the mpv console\n\n```\nchange-list script-opts append afs-enable=no\nchange-list script-opts append afs-sub_forced_only=no\nset script-opts afs-enable=yes,afs-sub_forced_only=yes\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierretom%2Fautoselect-forced-sub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpierretom%2Fautoselect-forced-sub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierretom%2Fautoselect-forced-sub/lists"}