Skip to main content

Process XML Danmaku File from BililiveRecorder

Project description

Bilibili Live Danmaku Tools 哔哩哔哩直播弹幕处理工具

本工具可用于处理 B站录播姬 产生的弹幕 XML。具体功能有:

  1. 分切 弹幕 XML
  2. 合并 弹幕 XML
  3. 分析 弹幕 XML 中的弹幕数量以及礼物价格
  4. 分析 弹幕 XML 中的高能点(主要用于生成录播)

安装

pip3 install danmaku_tools

典型使用例子

合并

根据 flv 文件的长度合并 XML

python3 -m danmaku_tools.merge_danmaku video_1.xml video_2.xml video_3.xml --video_time ".flv" --output video_combined.xml

经常和类似这样的视频合并命令同时使用

echo "file video_1.flv\n file video_2.flv" > video_input.txt
ffmpeg -f concat -safe 0 -i video_input.txt -c copy video_combined.flv

根据 XML 开始时间合并 XML

python3 -m danmaku_tools.merge_danmaku video_1.xml video_2.xml video_3.xml --output video_combined.xml

剪切

从 123.45 秒开始剪切 XML

python3 -m danmaku_tools.cut_danmaku --start_time 123.45 video_input.xml --output video_output.xml

从 123.45 秒到 567.89 开始剪切 XML

python3 -m danmaku_tools.cut_danmaku --start_time 123.45 --end_time 567.89 video_input.xml --output video_output.xml

经常和类似这样的视频剪切命令同时使用

ffmpeg -ss 123.45 -to 567.89 -i video_input.flv video_output.flv

分析流水

python3 -m danmaku_tools.analyze_danmaku video.xml

输出如下:

弹幕:46541条
醒目留言:15294.0元
礼物:7366.440000000309元
大航海:10116.0元
大航海类别:{'舰长': 41, '提督': 1}
总流水 32776.44000000031元

分析高能

python3 -m danmaku_tools.danmaku_energy_map video.xml `# 输入 XML 文件` \
  --graph video.he.png `# 高能进度条 png` \
  --he_map he_list.txt `# 高能列表` \
  --sc_list sc_list.txt `# 醒目留言列表` \
  --sc_srt sc.srt `# 醒目留言字幕` \
  --he_time he_time.txt `# 最高能时间点` \
  --he_range he_range.txt `# 最高能时间段`

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

danmaku-tools-0.0.9.tar.gz (25.5 kB view details)

Uploaded Source

Built Distribution

danmaku_tools-0.0.9-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file danmaku-tools-0.0.9.tar.gz.

File metadata

  • Download URL: danmaku-tools-0.0.9.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for danmaku-tools-0.0.9.tar.gz
Algorithm Hash digest
SHA256 2cdcbdae817ec5220673d1f079dd029c4c8422aad781f06981ba3ee6b04c6302
MD5 964a92a974f0c53d4fd8b7effc0b9d16
BLAKE2b-256 febd06e7801d40bea37341e31e567927d4500c1a87401155ff5cf7fd1bc31278

See more details on using hashes here.

File details

Details for the file danmaku_tools-0.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for danmaku_tools-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 866fa5cbd016ff7dc10caa6c06591165082a8dba9c0e91700960a01505f0a541
MD5 2cabbc6e8fe830df0a1bd42a281cba46
BLAKE2b-256 6ebce2fb5b7b20c5fac3cfd199cdf8eaa4b80c2959f974dd6c12bdc79f6eb96d

See more details on using hashes here.

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