yt-dlp-danmaku
yt-dlp plugin for converting Bilibili danmaku into ASS format. Powered by biliass.
Installation and upgrading
Requires yt-dlp 2023.01.02 or above.
You can install or upgrade this package with pip:
pip install -U yt-dlp-danmaku
Usage
Download video along with the ASS subtitle
yt-dlp --write-subs --use-postprocessor danmaku https://www.bilibili.com/video/BV1Sm4y1N78J
Download video embedded with danmaku as a subtitle stream
Bilibili videos are originally mp4 format, but this format does not support ASS subtitle. Therefore, you need to use another format that supports it, such as mkv:
yt-dlp --embed-subs --use-postprocessor danmaku --remux-video mkv https://www.bilibili.com/video/BV1Sm4y1N78J
You can then try playing this video with players that support ASS subtitles, such as mpv and VLC.
Download video and "burn" the danmaku onto it
You need to run FFmpeg yourself to do this. Here is an example how you can do that:
yt-dlp --write-subs --use-postprocessor danmaku --output input https://www.bilibili.com/video/BV1Sm4y1N78J
ffmpeg -i input.mp4 -vf subtitles=input.danmaku.ass output.mp4
rm input.mp4 input.danmaku.ass
Get ASS subtitle without downloading the video
yt-dlp --write-subs --use-postprocessor danmaku:when=before_dl --skip-download https://www.bilibili.com/video/BV1Sm4y1N78J
Use with mpv
mpv --script-opts=ytdl_hook-ytdl_path=yt-dlp --ytdl-raw-options=use-postprocessor=danmaku:when=before_dl,write-subs=,no-simulate=,skip-download= https://www.bilibili.com/video/BV1Sm4y1N78J
You can turn on and off danmaku by using j (by default).
Add --sid=1 to turn on danmaku on start.
You can add these options to your mpv config file.
Notice: this will leave an ASS file in the current directory. Delete it afterwards if you do not want it.
Configuration
You can pass options to this plugin.
For example, to set the opacity of danmaku texts to 0.1 and reserve the bottom half, use
--use-postprocessor danmaku:text_opacity=0.1;display_region_ratio=0.5.
All available options:
| Option | Default | Meaning |
|---|---|---|
lang |
danmaku | Language selector; you do not normally need to set this |
display_region_ratio |
1.0 | |
font_face |
sans-serif | |
font_size |
max(width,height)/60 | |
text_opacity |
0.8 | |
duration_marquee |
15 | |
duration_still |
10 | |
block_top |
false | |
block_bottom |
false | |
block_scroll |
false | |
block_reverse |
false | |
block_fixed |
false | |
block_special |
false | |
block_colorful |
false | |
block_keyword_patterns |
||
reduce_comments |
false |
Run biliass -h for more information about these options.
Development
See the Plugin Development section of the yt-dlp wiki.
License
MIT.
MIT License
Copyright (c) 2022 Ulysses Zhan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Metadata
Release files for yt-dlp-danmaku 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yt_dlp_danmaku-0.3.0.tar.gz | 5.2 kB | With provenance | Details for yt_dlp_danmaku-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yt_dlp_danmaku-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for yt_dlp_danmaku-0.3.0-py3-none-any.whl |
Total release size: 11.8 kB
Release files / yt_dlp_danmaku-0.3.0.tar.gz
| Download URL | yt_dlp_danmaku-0.3.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8720fd909fa6085ad55b9f43876a27f662cecf0bdc7d84fbb935574b08b8e6fa
|
|
BLAKE2b-256 checksum How to use checksums |
0aff7f98c243bad7bc751f02cac8440cafc4c3151d542e0085c0dd2dafd28a5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.
Transparency logRelease files / yt_dlp_danmaku-0.3.0-py3-none-any.whl
| Download URL | yt_dlp_danmaku-0.3.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9664e3b45cbd29cc8476505cffd5d28889e1ce9699732565dad8c681d1e7fbbe
|
|
BLAKE2b-256 checksum How to use checksums |
cdbdd03b5ea6fa44da9ae60f2d026ca894477bf893e6884ed2eea2fede1cca19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.
Transparency logSecurity for yt-dlp-danmaku 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for yt_dlp_danmaku-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.