softchat


Namesoftchat JSON
Version 1.6 PyPI version JSON
download
home_pagehttps://github.com/9001/softchat
Summaryconvert twitch/youtube chat into softsubs
upload_time2023-08-22 19:50:06
maintainer
docs_urlNone
authored
requires_python>=3.6
licenseMIT
keywords youtube chat converter danmaku marquee softsubs ass subtitles
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # softchat
* convert twitch/youtube chat into softsubs ([webm](https://ocv.me/dev/softchat.webm))
* supports windows, macos, linux, freebsd
* MIT-Licensed, 2020-10-12, ed @ irc.rizon.net


# quality
* well-tested, well-regarded software
* check out some of the authentic user feedback below
![user feedback](./glowing-reviews.png)


# readme TOC

* [top](#softchat)
* [howto](#howto)
    * [first-time setup](#first-time-setup)
    * [regular usage](#regular-usage)
    * [checking for updates](#checking-for-updates)
    * [common problems](#common-problems)
        * [certificate errors on windows](#certificate-errors-on-windows)
        * [missing cookies](#missing-cookies)
* [advice](#advice)
* [bugs](#bugs)
* [about](#about)
* [dependencies](#dependencies)
* [maintainers](#maintainers)


# howto

windows users:
* press Win+R and run `cmd` to get a terminal to run commands in (protip: rightclick to paste stuff)
* replace `python3` with `python` in all commands
* see [common problems](#common-problems) if you run into issues


## first-time setup

* run these commands:

      python3 -m pip install --user softchat chat-downloader fugashi[unidic]
      python3 -m unidic download

* download https://ocv.me/stuff/NotoSansCJKjp-Regular.otf into a folder named `noto-hinted` in the same place you keep your VOD rips

* if you want graphical emotes, see `--emote_font` in [dependencies](#dependencies)


## regular usage

* download/convert a youtube VOD automatically with [ytdl-tui.py](./contrib/ytdl-tui.py) (save it next to the `noto-hinted` folder, not inside it), then either doubleclick it or:

      python3 ytdl-tui.py youtube.com/watch?v=4dlsbJiEa-U

* ...or do the downloads/conversion steps manually like this:

      python3 -m youtube_dl youtube.com/watch?v=4dlsbJiEa-U
      python3 -m chat_downloader --message_groups all -o same-filename.json youtube.com/watch?v=4dlsbJiEa-U
      python3 -m softchat -m2 same-filename.json

  the json filename should be whatever `youtube-dl` decides to use, except replace the extension with `.json` (and remember quotes depending on OS)


## checking for updates

update to the latest version by running this:

    python3 -m pip install --user -U softchat chat-downloader

this does not cover ytdl-tui; to check for ytdl-tui updates, run it and press uu


## common problems

### certificate errors on windows

errors like the following:  
`[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate`

* open Internet Explorer (yes really) and access each of these URLs once:
  * https://pypi.org/  (to install stuff with pip)
  * https://raw.githubusercontent.com/  (if you use ytdl-tui)
  * https://youtube.com/  (no need to accept cookies or consent to whatever, just accessing it is enough)
* <sub>apparently this is how windows loads certificates into the cert-store? ms pls</sub>


### missing cookies

symptoms:
* youtube-dl failing because the video is members-only
* chat-downloader spamming a bunch of javascript then exiting

note: generally ytdl-tui should handle most of these scenarios, so you could try that first, otherwise read on

let's export your cookies and make them available to chat-downloader and youtube-dl; should dodge captchas, make it possible to donwload members-only stuff, and also fix the recent consent requirement from EU members

* install the following addon: https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/
* access youtube.com, click the extension icon, `[Current Site]`
* save as `cookies.txt` into your VODs folder (next to the `noto-hinted` folder)
* ytdl-tui will now avoid the issue

repeat these steps if it breaks again

if you run chat-downloader manually instead of `ytdl-tui`, append these arguments: `-c cookies.txt`

.

# advice

`mpv` is the recommended player, however in danmaku mode, you should resample the video to your monitor's FPS.
* one way to do this: adding the argument `--vf=fps=120` every time
* another way is adding the following line to `input.conf`, which lets you press shift-U to toggle upscaling to 120 fps:
  ```
  U vf toggle fps=120
  ```
* on linux/mac, `input.conf` should be here: `~/.config/mpv/input.conf`
* on windows, `input.conf` should be here: `%appdata%\mpv\input.conf`

additionally, on windows you *may* need to `--vo=direct3d` and *not* fullscreen for resampling to work -- try the different alternatives in `--vo=help` and find one which:
1. doesn't ruin the contrast
2. doesn't make the text blurry
3. doesn't make the text jitter

The fonts produced by `--emote_font` need to be somewhere your media player can see them (either embedded, or in some autoload folder, or installed as system fonts). Set `--emote_install` to install fonts into `~/.config/mpv/fonts/` (Linux/macos) or `%appdata%\mpv\fonts` (windows) for local playback using mpv. For other media players, or if you intend to share the subtitles, you should use `--embed_files` as each font is specific to that particular subtitle file and they need to be used together.

Override automatically vectorized emotes by creating a ".manual.svg" file in the cache directory. So for the emote `UCS9uQI-jC3DE0L4IpXyvr6w_Do6dXuL6LZCQ_AP4-buoDQ` create the file `UCS9uQI-jC3DE0L4IpXyvr6w_Do6dXuL6LZCQ_AP4-buoDQ.manual.svg`. This can be used for emotes where the automatic version is of low quality.

Similarly, rather than using `--emote_fill` to fill the background of all emotes, you can create an empty file named `UCS9uQI-jC3DE0L4IpXyvr6w_Do6dXuL6LZCQ_AP4-buoDQ.bg` to enable bg-fill for just that one emote.


# bugs

* `--emote_sz 3` and higher makes things collide (wontfix probably)


# about

* superchats will display for 2x the time and with inverted colors

* moderator messages are emphasized  
  (larger outline, and prefixed with a ball)

* mode 1, sidebar chat, creates a huge amount of subtitle events  
  which many media players (including mpv) will struggle with

  for example, seeking will take like 5sec

  you can fix this by muxing the subtitle into the vid:  
  `ffmpeg -i the.webm -i the.ass -c copy muxed.mkv`

* mode 2, danmaku, will look blurry and/or jerky in most players  
  unless you have the subtitles render at your native screen res

  for example in mpv you could add these arguments:  
  `--vo=direct3d --sub-delay=-2 --vf=fps=90`

  replace 90 with your monitor's fps

* after an upgrade, you can reconvert old rips like this:  
  `grep -lE '^Title: .*softchat' -- *.ass | tr '\n' '\0' | xargs -0rtl python3 -m softchat -m2 --`

* youtube VOD chatlogs are incomplete (about 80% of messages are lost)  
  so softchat can now take multiple chat JSONs to splice together:  
  it is recommended to run chat_replay_downloader.py twice,  
  first when the stream is live and then afterwards for the VOD chat;  
  when running softchat, the VOD json should be the first file provided,  
  followed by any live recordings to splice messages from

* on windows, `--kana` requires python 3.8 or newer


# dependencies

* chatrips must be made using https://github.com/xenova/chat-downloader
  * softchat will be updated as the output format of chat-downloader changes

* a copy of `NotoSansCJKjp-Regular.otf` in a folder named `noto-hinted`
  * download here: https://ocv.me/stuff/NotoSansCJKjp-Regular.otf
  * or here: https://noto-website-2.storage.googleapis.com/pkgs/Noto-hinted.zip
  * in the future (tm) softchat will require all the Noto-fonts in this folder

* required python libraries: `Pillow fontTools`

* enable `--kana` (convert kanji to hiragana) with these:

      python3 -m pip install --user fugashi[unidic]
      python3 -m unidic download

* enable `--emote_font` with:
  * [fontforge](https://fontforge.org)
  * [ImageMagick](https://imagemagick.org)
  * [potrace](http://potrace.sourceforge.net/)  (not required on windows)
  * **on debian:** `apt install potrace python3-fontforge`

note: on windows, cmd must be reopened after installing dependencies


# maintainers

* build and release: `python setup.py rls`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/9001/softchat",
    "name": "softchat",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "youtube chat converter danmaku marquee softsubs ass subtitles",
    "author": "ed",
    "author_email": "softchat@ocv.me",
    "download_url": "https://files.pythonhosted.org/packages/96/eb/f7ebb003710de4019f8596208966f3851cb06c9e26d75e77020d12d413e9/softchat-1.6.tar.gz",
    "platform": null,
    "description": "# softchat\n* convert twitch/youtube chat into softsubs ([webm](https://ocv.me/dev/softchat.webm))\n* supports windows, macos, linux, freebsd\n* MIT-Licensed, 2020-10-12, ed @ irc.rizon.net\n\n\n# quality\n* well-tested, well-regarded software\n* check out some of the authentic user feedback below\n![user feedback](./glowing-reviews.png)\n\n\n# readme TOC\n\n* [top](#softchat)\n* [howto](#howto)\n    * [first-time setup](#first-time-setup)\n    * [regular usage](#regular-usage)\n    * [checking for updates](#checking-for-updates)\n    * [common problems](#common-problems)\n        * [certificate errors on windows](#certificate-errors-on-windows)\n        * [missing cookies](#missing-cookies)\n* [advice](#advice)\n* [bugs](#bugs)\n* [about](#about)\n* [dependencies](#dependencies)\n* [maintainers](#maintainers)\n\n\n# howto\n\nwindows users:\n* press Win+R and run `cmd` to get a terminal to run commands in (protip: rightclick to paste stuff)\n* replace `python3` with `python` in all commands\n* see [common problems](#common-problems) if you run into issues\n\n\n## first-time setup\n\n* run these commands:\n\n      python3 -m pip install --user softchat chat-downloader fugashi[unidic]\n      python3 -m unidic download\n\n* download https://ocv.me/stuff/NotoSansCJKjp-Regular.otf into a folder named `noto-hinted` in the same place you keep your VOD rips\n\n* if you want graphical emotes, see `--emote_font` in [dependencies](#dependencies)\n\n\n## regular usage\n\n* download/convert a youtube VOD automatically with [ytdl-tui.py](./contrib/ytdl-tui.py) (save it next to the `noto-hinted` folder, not inside it), then either doubleclick it or:\n\n      python3 ytdl-tui.py youtube.com/watch?v=4dlsbJiEa-U\n\n* ...or do the downloads/conversion steps manually like this:\n\n      python3 -m youtube_dl youtube.com/watch?v=4dlsbJiEa-U\n      python3 -m chat_downloader --message_groups all -o same-filename.json youtube.com/watch?v=4dlsbJiEa-U\n      python3 -m softchat -m2 same-filename.json\n\n  the json filename should be whatever `youtube-dl` decides to use, except replace the extension with `.json` (and remember quotes depending on OS)\n\n\n## checking for updates\n\nupdate to the latest version by running this:\n\n    python3 -m pip install --user -U softchat chat-downloader\n\nthis does not cover ytdl-tui; to check for ytdl-tui updates, run it and press uu\n\n\n## common problems\n\n### certificate errors on windows\n\nerrors like the following:  \n`[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate`\n\n* open Internet Explorer (yes really) and access each of these URLs once:\n  * https://pypi.org/  (to install stuff with pip)\n  * https://raw.githubusercontent.com/  (if you use ytdl-tui)\n  * https://youtube.com/  (no need to accept cookies or consent to whatever, just accessing it is enough)\n* <sub>apparently this is how windows loads certificates into the cert-store? ms pls</sub>\n\n\n### missing cookies\n\nsymptoms:\n* youtube-dl failing because the video is members-only\n* chat-downloader spamming a bunch of javascript then exiting\n\nnote: generally ytdl-tui should handle most of these scenarios, so you could try that first, otherwise read on\n\nlet's export your cookies and make them available to chat-downloader and youtube-dl; should dodge captchas, make it possible to donwload members-only stuff, and also fix the recent consent requirement from EU members\n\n* install the following addon: https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/\n* access youtube.com, click the extension icon, `[Current Site]`\n* save as `cookies.txt` into your VODs folder (next to the `noto-hinted` folder)\n* ytdl-tui will now avoid the issue\n\nrepeat these steps if it breaks again\n\nif you run chat-downloader manually instead of `ytdl-tui`, append these arguments: `-c cookies.txt`\n\n.\n\n# advice\n\n`mpv` is the recommended player, however in danmaku mode, you should resample the video to your monitor's FPS.\n* one way to do this: adding the argument `--vf=fps=120` every time\n* another way is adding the following line to `input.conf`, which lets you press shift-U to toggle upscaling to 120 fps:\n  ```\n  U vf toggle fps=120\n  ```\n* on linux/mac, `input.conf` should be here: `~/.config/mpv/input.conf`\n* on windows, `input.conf` should be here: `%appdata%\\mpv\\input.conf`\n\nadditionally, on windows you *may* need to `--vo=direct3d` and *not* fullscreen for resampling to work -- try the different alternatives in `--vo=help` and find one which:\n1. doesn't ruin the contrast\n2. doesn't make the text blurry\n3. doesn't make the text jitter\n\nThe fonts produced by `--emote_font` need to be somewhere your media player can see them (either embedded, or in some autoload folder, or installed as system fonts). Set `--emote_install` to install fonts into `~/.config/mpv/fonts/` (Linux/macos) or `%appdata%\\mpv\\fonts` (windows) for local playback using mpv. For other media players, or if you intend to share the subtitles, you should use `--embed_files` as each font is specific to that particular subtitle file and they need to be used together.\n\nOverride automatically vectorized emotes by creating a \".manual.svg\" file in the cache directory. So for the emote `UCS9uQI-jC3DE0L4IpXyvr6w_Do6dXuL6LZCQ_AP4-buoDQ` create the file `UCS9uQI-jC3DE0L4IpXyvr6w_Do6dXuL6LZCQ_AP4-buoDQ.manual.svg`. This can be used for emotes where the automatic version is of low quality.\n\nSimilarly, rather than using `--emote_fill` to fill the background of all emotes, you can create an empty file named `UCS9uQI-jC3DE0L4IpXyvr6w_Do6dXuL6LZCQ_AP4-buoDQ.bg` to enable bg-fill for just that one emote.\n\n\n# bugs\n\n* `--emote_sz 3` and higher makes things collide (wontfix probably)\n\n\n# about\n\n* superchats will display for 2x the time and with inverted colors\n\n* moderator messages are emphasized  \n  (larger outline, and prefixed with a ball)\n\n* mode 1, sidebar chat, creates a huge amount of subtitle events  \n  which many media players (including mpv) will struggle with\n\n  for example, seeking will take like 5sec\n\n  you can fix this by muxing the subtitle into the vid:  \n  `ffmpeg -i the.webm -i the.ass -c copy muxed.mkv`\n\n* mode 2, danmaku, will look blurry and/or jerky in most players  \n  unless you have the subtitles render at your native screen res\n\n  for example in mpv you could add these arguments:  \n  `--vo=direct3d --sub-delay=-2 --vf=fps=90`\n\n  replace 90 with your monitor's fps\n\n* after an upgrade, you can reconvert old rips like this:  \n  `grep -lE '^Title: .*softchat' -- *.ass | tr '\\n' '\\0' | xargs -0rtl python3 -m softchat -m2 --`\n\n* youtube VOD chatlogs are incomplete (about 80% of messages are lost)  \n  so softchat can now take multiple chat JSONs to splice together:  \n  it is recommended to run chat_replay_downloader.py twice,  \n  first when the stream is live and then afterwards for the VOD chat;  \n  when running softchat, the VOD json should be the first file provided,  \n  followed by any live recordings to splice messages from\n\n* on windows, `--kana` requires python 3.8 or newer\n\n\n# dependencies\n\n* chatrips must be made using https://github.com/xenova/chat-downloader\n  * softchat will be updated as the output format of chat-downloader changes\n\n* a copy of `NotoSansCJKjp-Regular.otf` in a folder named `noto-hinted`\n  * download here: https://ocv.me/stuff/NotoSansCJKjp-Regular.otf\n  * or here: https://noto-website-2.storage.googleapis.com/pkgs/Noto-hinted.zip\n  * in the future (tm) softchat will require all the Noto-fonts in this folder\n\n* required python libraries: `Pillow fontTools`\n\n* enable `--kana` (convert kanji to hiragana) with these:\n\n      python3 -m pip install --user fugashi[unidic]\n      python3 -m unidic download\n\n* enable `--emote_font` with:\n  * [fontforge](https://fontforge.org)\n  * [ImageMagick](https://imagemagick.org)\n  * [potrace](http://potrace.sourceforge.net/)  (not required on windows)\n  * **on debian:** `apt install potrace python3-fontforge`\n\nnote: on windows, cmd must be reopened after installing dependencies\n\n\n# maintainers\n\n* build and release: `python setup.py rls`\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "convert twitch/youtube chat into softsubs",
    "version": "1.6",
    "project_urls": {
        "Homepage": "https://github.com/9001/softchat"
    },
    "split_keywords": [
        "youtube",
        "chat",
        "converter",
        "danmaku",
        "marquee",
        "softsubs",
        "ass",
        "subtitles"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dda09228a4c1b1ad99cabcba7098e7a53d1da26f0ceba7f73bb5689b60bff4c9",
                "md5": "bc329d5a2e67efe7b3dd4c64a8d6e849",
                "sha256": "71c1b621c03a8c7319d3f212586c9f2a928467a5a59b21fde461170be018fabd"
            },
            "downloads": -1,
            "filename": "softchat-1.6-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bc329d5a2e67efe7b3dd4c64a8d6e849",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 33062,
            "upload_time": "2023-08-22T19:50:03",
            "upload_time_iso_8601": "2023-08-22T19:50:03.631697Z",
            "url": "https://files.pythonhosted.org/packages/dd/a0/9228a4c1b1ad99cabcba7098e7a53d1da26f0ceba7f73bb5689b60bff4c9/softchat-1.6-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "96ebf7ebb003710de4019f8596208966f3851cb06c9e26d75e77020d12d413e9",
                "md5": "08404f4dc67f2c240f409cb532c7d45e",
                "sha256": "f6600c12f1db5891467eb2656aee8984b0d8c707cca04bf4eb4ca78d8f5d839e"
            },
            "downloads": -1,
            "filename": "softchat-1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "08404f4dc67f2c240f409cb532c7d45e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 35233,
            "upload_time": "2023-08-22T19:50:06",
            "upload_time_iso_8601": "2023-08-22T19:50:06.147596Z",
            "url": "https://files.pythonhosted.org/packages/96/eb/f7ebb003710de4019f8596208966f3851cb06c9e26d75e77020d12d413e9/softchat-1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-22 19:50:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "9001",
    "github_project": "softchat",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "softchat"
}
        
ed
Elapsed time: 0.10833s