A Python tool for recording and creating clips from Danmu (弹幕 - bullet comments) on Bilibili videos. This tool allows you to automatically generate video clips based on danmu messages, making it easy to extract highlights and moments of interest from long streams or recordings.
- Multi-source support: Download videos and danmu from Bilibili or use local recordings from 录播姬
- Smart clipping: Generate video clips based on danmu messages from specific users
- Batch processing: Process multiple clips efficiently with progress tracking
- FFmpeg integration: Uses FFmpeg for reliable video processing
- User-friendly GUI: Dialog-based interface for easy directory and file selection
- Python 3.7+
- FFmpeg and FFprobe binaries (included in
bin/directory) - Windows OS (currently Windows-only due to
msvcrtdependency)
-
Clone the repository:
git clone <repository-url> cd RecordDanmuClipTool
-
Install Python dependencies:
pip install -r requirements.txt
-
Run the main script:
python RDCTool.py
-
Select your working directory when prompted
-
Choose your danmu source:
- Option 1 (Bilibili): Enter a Bilibili video BV ID (e.g., BV1Xx411c7mD)
- Option 2 (Local recording): Select a local video file and its corresponding danmu XML file
-
Enter the UIDs of the users whose danmu you want to use for clipping (space-separated)
-
Review the generated clips and confirm to process them
-
Clips will be saved to the
切片/(clips) folder in your working directory
RecordDanmuClipTool/
├── RDCTool.py # Main application entry point
├── requirements.txt # Python dependencies
├── bin/ # FFmpeg binaries
│ ├── ffmpeg.exe
│ └── ffprobe.exe
└── DanmakuClipLib/ # Core library
├── __init__.py
├── clip_factory.py # Video clipping logic
├── danmaku_factory.py # Danmu parsing and processing
├── data_loader.py # Data loading from sources
├── rewrited_bilibili_api.py # Bilibili API wrapper
├── const.py # Constants
└── utils.py # Utility functions
Handles video clipping operations. Creates clips from a video file based on specified time ranges.
Processes danmu (bullet comment) data and generates clip information based on messages from specific users.
Manages data retrieval:
- Downloads videos from Bilibili using BV IDs
- Retrieves danmu XML files
- Loads local video and danmu files
Working directory structure (auto-created):
录播/- Recorded/downloaded video files切片/- Generated video clips
bilibili_api- Bilibili video and danmu data fetchinglxml- XML parsing for danmu fileseasygui- User interface for dialogsrequests- HTTP requestsprettytable- Table formatting for displaytqdm- Progress barsbetter_exceptions- Enhanced exception messages
[Add your license information here]
[Add contribution guidelines here]
- Currently supports Windows only
- Requires FFmpeg binaries in the
bin/directory - Bilibili API access may be subject to rate limiting
- Large videos may take time to process
- "请选择工作目录": You must select a working directory for the tool to function
- Video not found: Ensure the BV ID is correct or that your local video file exists
- FFmpeg not found: Make sure FFmpeg binaries are present in
bin/directory