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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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