Skip to main content

Auto slice the highlight shorts based on the density of danmaku.

Project description

auto-slice-video

Auto slice the highlight shorts based on the density of danmaku.

English | 简体中文

Features

  • Detect the dense period of danmaku based on the sliding window algorithm.
  • Slice the video based on the density of danmaku.
  • Support GPU accelerated calculation.(Automatically choose whether to use GPU acceleration)
  • Support custom quantity slicing videos.
  • Support custom slice duration.
  • Add detailed log information.
  • Support cli usage and api usage.

Demo

Installation

To use this tool, you need to install ffmpeg first.

  • Windows: choco install ffmpeg (via Chocolatey) or other methods.
  • macOS: brew install ffmpeg (via Homebrew).
  • Linux: sudo apt install ffmpeg (Debian/Ubuntu).

More OS please refer to the official website.

pip install autosv

Usage

cli usage

# eg. The default parameters are shown in autosv -h
autosv -a sample.ass -v sample.mp4
autosv -a sample.ass -v sample.mp4 -d 300 -n 3 --overlap 60 --step 1
autosv -h
# optional arguments:
#   -h, --help            show this help message and exit
#   -V, --version         Print version information
#   -a ASS, --ass ASS     The input ass file of the danmaku
#   -v VIDEO, --video VIDEO
#                         The input video file
#   -d DURATION, --duration DURATION
#                         The duration(seconds) of the sliced highlight video, default is 60
#   -n TOP_N, --top_n TOP_N
#                         The number of the top dense periods to return, default is 1
#   --overlap OVERLAP     The overlapped(seconds) between the sliced highlight videos, default is 30
#   --step STEP           The step(seconds) of the sliding window, default is 1

api usage

from autosv import slice_video_by_danmaku
# The default parameters are the same as the cli usage
slice_video_by_danmaku(ass_path, video_path, duration=300, top_n=3, max_overlap=60, step=1)

common issues

Why I cannot use the gpu acceleration?

The autosv will detect whether the cuda is available on the machine via nvcc -V, if your machine has nvidia gpu, please make sure your driver is installed and the cuda is available. Meanwhile, make sure you have installed the numba and numpy with the right version.

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

autosv-0.0.1.tar.gz (363.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autosv-0.0.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file autosv-0.0.1.tar.gz.

File metadata

  • Download URL: autosv-0.0.1.tar.gz
  • Upload date:
  • Size: 363.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.16

File hashes

Hashes for autosv-0.0.1.tar.gz
Algorithm Hash digest
SHA256 727b21927b44935ee923e8db73957398a85702c7a930d658301a220b2cd8fd11
MD5 e30a72f8159d6af8df5678cfe11c1531
BLAKE2b-256 caca4e89dd6cd5a973a4bdd48098dc66fdf733a7fdf53e6c24ca444b2da4b196

See more details on using hashes here.

File details

Details for the file autosv-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: autosv-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.16

File hashes

Hashes for autosv-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 40712ead5a662c2065b19ecddb6c06ac22c675bf9b785ed7ac1ec8b7613c8ce0
MD5 621008f50848b38de9d4f2ff36c63ecb
BLAKE2b-256 18f50e75df6a9a21d52529fc8c09bd4dae32e98d545092e438a023a41d7232b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page