Skip to content

ratchips/RecordDanmuClipTool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Record Danmu Clip Tool (RDCT)

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.

Features

  • 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

Requirements

  • Python 3.7+
  • FFmpeg and FFprobe binaries (included in bin/ directory)
  • Windows OS (currently Windows-only due to msvcrt dependency)

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd RecordDanmuClipTool
  2. Install Python dependencies:

    pip install -r requirements.txt

Usage

  1. Run the main script:

    python RDCTool.py
  2. Select your working directory when prompted

  3. 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
  4. Enter the UIDs of the users whose danmu you want to use for clipping (space-separated)

  5. Review the generated clips and confirm to process them

  6. Clips will be saved to the 切片/ (clips) folder in your working directory

Project Structure

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

Key Components

ClipFactory

Handles video clipping operations. Creates clips from a video file based on specified time ranges.

DanmakuFactory

Processes danmu (bullet comment) data and generates clip information based on messages from specific users.

DataLoader

Manages data retrieval:

  • Downloads videos from Bilibili using BV IDs
  • Retrieves danmu XML files
  • Loads local video and danmu files

Configuration

Working directory structure (auto-created):

  • 录播/ - Recorded/downloaded video files
  • 切片/ - Generated video clips

Dependencies

  • bilibili_api - Bilibili video and danmu data fetching
  • lxml - XML parsing for danmu files
  • easygui - User interface for dialogs
  • requests - HTTP requests
  • prettytable - Table formatting for display
  • tqdm - Progress bars
  • better_exceptions - Enhanced exception messages

License

[Add your license information here]

Contributing

[Add contribution guidelines here]

Notes

  • 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

Troubleshooting

  • "请选择工作目录": 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

About

录播弹幕切片工具

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages