Skip to main content

Faster conversion for larger Danmaku to Ass format

Project description

danmakuC

Faster conversion for larger Danmaku to Ass format. Core conversion part is written in C++ while with user-friendly Python api and cli.

Currently, support types:

Why danmakuC?

.ass format can be recognized by your local video player, while Danmaku2ASS and biliass provides a great tool to convert danmaku to ass format, the conversion of large danmaku is incredibly slow since it's a heavy CPU bound task for Python🥲. danmakuC refactor those two repos and provide a much faster C++ implementation to speed up conversion. Let's see how fast it is:

test_dm.bin (218 comments) test_dm_large.bin (59,003 comments)
Danmaku2ASS/biliass 0.0105 s 47.0650 s
danmakuC 0.0009 s 0.2077 s

Results are obtained in M1 arm64 chip mac with python3.10 danmakuC v0.1a0, danmaku file is downloaded from bilibili by bilix.

As you can see, over 100 times faster in large conversion. For video with more viewer and comments (like movie and tv play), a fast tool like danmakuC is just what you need✊.

Install

pip install danmakuC

Usage

In python, you can use danmakuC like:

from danmakuC.bilibili import proto2ass

with open("test_dm_large.bin", "rb") as f:
    ass_text = proto2ass(f.read(), 1920, 1080)

If you prefer to use cli, you can use danmakuC like:

danmakuC src.bin -o tgt.ass

for more feature, you can check -h

danmakuC -h

usage: danmakuC [-h] [-o OUTPUT] [-s SIZE] [-rb RESERVE_BLANK] [-fn FONT] [-fs FONTSIZE] [-a ALPHA] [-dm DURATION_MARQUEE] [-ds DURATION_STILL] [-fl FILTER] [-r] [-v] file

danmakuC cli version 0.2a0

positional arguments:
  file                  Comment file to be processed

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        Output file
  -s SIZE, --size SIZE  Stage size in pixels [default: 1920x1080]
  -rb RESERVE_BLANK, --reserve-blank RESERVE_BLANK
                        Reserve blank on the bottom of the stage [default: 0]
  -fn FONT, --font FONT
                        Specify font face [default: sans-serif]
  -fs FONTSIZE, --fontsize FONTSIZE
                        Default font size [default: 25.0]
  -a ALPHA, --alpha ALPHA
                        Alpha [default: 1.0]
  -dm DURATION_MARQUEE, --duration-marquee DURATION_MARQUEE
                        Duration of scrolling comment display [default: 5.0]
  -ds DURATION_STILL, --duration-still DURATION_STILL
                        Duration of still comment display [default: 5.0]
  -fl FILTER, --filter FILTER
                        Regular expression to filter comments
  -r, --reduce          Reduce the amount of comments if stage is full
  -v, --version         show program's version number and exit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

danmakuC-0.3.6.tar.gz (2.0 MB view hashes)

Uploaded Source

Built Distributions

danmakuC-0.3.6-pp39-pypy39_pp73-win_amd64.whl (171.8 kB view hashes)

Uploaded PyPy Windows x86-64

danmakuC-0.3.6-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (271.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

danmakuC-0.3.6-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (292.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

danmakuC-0.3.6-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (217.0 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

danmakuC-0.3.6-pp38-pypy38_pp73-win_amd64.whl (171.9 kB view hashes)

Uploaded PyPy Windows x86-64

danmakuC-0.3.6-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (272.1 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

danmakuC-0.3.6-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (292.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

danmakuC-0.3.6-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (217.0 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

danmakuC-0.3.6-cp311-cp311-win_amd64.whl (172.4 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

danmakuC-0.3.6-cp311-cp311-win32.whl (151.7 kB view hashes)

Uploaded CPython 3.11 Windows x86

danmakuC-0.3.6-cp311-cp311-musllinux_1_1_x86_64.whl (792.3 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

danmakuC-0.3.6-cp311-cp311-musllinux_1_1_i686.whl (863.1 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

danmakuC-0.3.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (288.8 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

danmakuC-0.3.6-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (309.1 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

danmakuC-0.3.6-cp311-cp311-macosx_11_0_arm64.whl (201.5 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

danmakuC-0.3.6-cp311-cp311-macosx_10_9_x86_64.whl (221.4 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

danmakuC-0.3.6-cp310-cp310-win_amd64.whl (172.5 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

danmakuC-0.3.6-cp310-cp310-win32.whl (151.7 kB view hashes)

Uploaded CPython 3.10 Windows x86

danmakuC-0.3.6-cp310-cp310-musllinux_1_1_x86_64.whl (792.3 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

danmakuC-0.3.6-cp310-cp310-musllinux_1_1_i686.whl (863.2 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

danmakuC-0.3.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (288.8 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

danmakuC-0.3.6-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (309.0 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

danmakuC-0.3.6-cp310-cp310-macosx_11_0_arm64.whl (201.5 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

danmakuC-0.3.6-cp310-cp310-macosx_10_9_x86_64.whl (221.4 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

danmakuC-0.3.6-cp39-cp39-win_amd64.whl (172.2 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

danmakuC-0.3.6-cp39-cp39-win32.whl (151.8 kB view hashes)

Uploaded CPython 3.9 Windows x86

danmakuC-0.3.6-cp39-cp39-musllinux_1_1_x86_64.whl (792.6 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

danmakuC-0.3.6-cp39-cp39-musllinux_1_1_i686.whl (863.3 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

danmakuC-0.3.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (288.8 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

danmakuC-0.3.6-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (309.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

danmakuC-0.3.6-cp39-cp39-macosx_11_0_arm64.whl (201.6 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

danmakuC-0.3.6-cp39-cp39-macosx_10_9_x86_64.whl (221.6 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

danmakuC-0.3.6-cp38-cp38-win_amd64.whl (172.3 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

danmakuC-0.3.6-cp38-cp38-win32.whl (151.7 kB view hashes)

Uploaded CPython 3.8 Windows x86

danmakuC-0.3.6-cp38-cp38-musllinux_1_1_x86_64.whl (792.2 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

danmakuC-0.3.6-cp38-cp38-musllinux_1_1_i686.whl (862.9 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

danmakuC-0.3.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (288.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

danmakuC-0.3.6-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (308.9 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

danmakuC-0.3.6-cp38-cp38-macosx_11_0_arm64.whl (201.2 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

danmakuC-0.3.6-cp38-cp38-macosx_10_9_x86_64.whl (221.2 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page