Skip to main content

Video Danmaku

一个简单的视频弹幕处理工具,支持将弹幕文件叠加到视频上。

功能特点

  • 支持多种弹幕文件格式(JSON、ASS、SSA)
  • 支持弹幕颜色和透明度设置
  • 平滑的弹幕滚动效果
  • 命令行界面,使用简单

安装

环境要求

  • Python 3.10 或更高版本

安装步骤

使用 pip 安装:

pip install video_danmaku

使用方法

命令行使用

video-danmaku 输入视频路径 输出视频路径 弹幕文件路径

参数说明

  • 输入视频路径: 要处理的视频文件路径
  • 输出视频路径: 处理后的视频保存路径
  • 弹幕文件路径: 弹幕文件路径(支持 .json、.ass、.ssa 格式)

示例

# 使用 JSON 格式弹幕
video-danmaku input.mp4 output.mp4 danmaku.json

# 使用 ASS 格式弹幕
video-danmaku input.mp4 output.mp4 danmaku.ass

弹幕文件格式

JSON 格式

[
    {
        "text": "弹幕文本",
        "time_stamp": 1.0,
        "color": [255, 255, 255],
        "alpha": 255
    }
]
  • text: 弹幕文本
  • time_stamp: 出现时间(秒)
  • color: RGB颜色值
  • alpha: 透明度(0-255)

ASS/SSA 格式

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:01.00,0:00:05.00,Default,,0,0,0,,弹幕文本

许可证

本项目采用 MIT 许可证 - 详见 LICENSE 文件

致谢

  • OpenCV - 视频处理
  • Pillow - 图像处理
  • Typer - 命令行界面



Metadata

Release files for video_danmaku 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for video_danmaku 0.1.1
File Size Uploaded
video_danmaku-0.1.1.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for video_danmaku 0.1.1
File Interpreter ABI Platform
video_danmaku-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / video_danmaku-0.1.1.tar.gz

Download URL video_danmaku-0.1.1.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7310fca63eb77b101f80ee1a6bc641d646fc967739666d4732beec051de083b8
BLAKE2b-256 checksum
How to use checksums
a08997bb9f429ca4a2218a43d99f70fe4066cff15856da81704388a53a5a905d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.15 Windows/10

Release files / video_danmaku-0.1.1-py3-none-any.whl

Download URL video_danmaku-0.1.1-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa1d21f403e79cedfe1afa2c16724683f403ef395628ef6cd600d662f416b690
BLAKE2b-256 checksum
How to use checksums
97a13f23e5c4d776b52146739618da2336fbe611488772a32a30b50ab3ae8d0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.15 Windows/10

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page