Skip to main content

Slasher

A commmand-line tool and Python library for autonomous editing of livestreams via live chat activity.

Through Slasher, you (the chat member, not the creator) are the editor of the livestream! Through an ultra-simple algorithm, portions of a livestream where chat is unusually active are kept and concatenated together. This allows for the speedy (we are just downloading, processing, and creating text afterall) creation of highlights that your audience directly finds enjoying. Personally, I think that the highlights that my tool creates are quite fun to watch, and I at times forgot that they were created via a computer program!

Because of the nature of Slasher, the algorithm can occasionally cut off speech, take out chunks of long-running moments (singing), leave intervals without context. Luckily, Slasher can output project files compatible with video editors so that the editor is fully in control and can quickly integrate the tool into their workflow. Slasher will not be appropriate for all livestreams and editors, but it does what it can do really well and attempts to give the end-user as much control as they please!

With default settings (2x multiplier, 10-second intervals, zero delay), Slasher's filter mode can turn about one hour of content into seven minutes, making it easy to watch a two-or-three hour live stream during a lunch break, and quickly consume an 8-hour live stream in under an hour. Can't justify watching or editing a 24-hour livestream? Now you can! Don't care about occasionally awkward edits and just want a half-hour highlight half an hour after your livestream ends to get those sweet views? Be my guest! The possibilites with my tool should be quite endless, so go crazy!

Installation

As a developer, clone the project and run poetry install. Instructions for normal users coming soon!

Usage

Command-Line Interface

usage: slasher [-h] [--format {ffmpeg,ffsilencer,mlt}] [--output OUTPUT]
               [--duration DURATION] [--delay DELAY] [--start START]
               [--end END]
               {filter,top} ...

Leave the noise of VODs on the cutting room floor.

positional arguments:
  {filter,top}
    filter              remove intervals of a stream that don't meet a certain
                        comment threshold
        positional arguments:
          url                   a chat-downloader-compatible URL

        optional arguments:
          --multiplier MULTIPLIER, -m MULTIPLIER
                                intervals must have a number of messages greater than
                                the average times this (default: 2)

    top                 pick the top intervals from a stream sorted by
                        messages
        positional arguments:
          url                   a chat-downloader-compatible URL

        optional arguments:
          --amount AMOUNT, -a AMOUNT
                                 number of intervals you want to keep

optional arguments:
  -h, --help            show this help message and exit
  --format {ffmpeg,ffsilencer,mlt}, -f {ffmpeg,ffsilencer,mlt}
                        what output you want (default: mlt)
  --output OUTPUT, -o OUTPUT
                        where the format will be written to (default: stdout)
  --duration DURATION   how long an interval should be, uses Python's
                        timedelta syntax (default: ten seconds)
  --delay DELAY         how far back messages should be pushed back, used to
                        sync chat with stream, uses Python's timedelta syntax
                        (default: zero seconds)
  --start START         capture messages from this time, uses Python's
                        timedelta syntax (default: zero seconds)
  --end END             capture messages to this time, uses Python's timedelta
                        syntax (default: timedelta.max)

Python Library

The entirety of Slasher sans the command line app is less than 150 lines, is fully typed, and has docstrings that give you the gist of what each function does, so just read it!

Examples

Slasher comes with sensible defaults, so usage is as basic as:

python -m slasher filter https://www.twitch.tv/videos/1080642970
python -m slasher top https://www.twitch.tv/videos/1080642970
from slasher import Slasher
s = Slasher.from_url("https://www.twitch.tv/videos/1080642970")
s = s.filter()

If you want to write your results to a file:

python -m slasher --output intervals.mlt filter https://www.twitch.tv/videos/1080642970
with open("intervals.mlt", "w") as f:
    s.to_mlt(f)

For more examples of Python lib usage, see examples/

Formats

MLT XML

CLI: --format mlt

Python: Slasher.to_mlt

This is an XML document format compatible with the open-source multimedia framework MLT, and can be opened in compatible video editors such as Shotcut. I have no plans to support other video editors as most are expensive or are exclusive to macOS.

FFsilencer

CLI: --format ffsilencer

Python: Slasher.to_ffsilencer

This is a basic plain-text format with a timesecond in seconds on the left and a duration in seconds on the right, like 2550 10. This is inspired by a Bash script I wrote to remove silence from videos with FFmpeg. Until I add some sort of "custom" option to FFsilencer, advanced users can feel free to download and use a modified version of FFsilencer I made for this project.

FFmpeg Filter Complex

!FOR ADVANCED USERS!

CLI: --format ffmpeg

Python: Slasher.to_ffmpeg_filter_complex

This is an implementation of FFsilencer's filter complex creator in Python. The video and audio streams used are [outv] and [outa] respectively. With FFmpeg, use it like this:

ffmpeg -hide_banner -i $IN -filter_complex_script $SCRIPT -map [outv] -map [outa] $OUT

Resources

For info on how timedelta works, see the Python docs. To see what sites Slasher supports, see Chat Downloader

License

https://unlicense.org/

Metadata

Release files for stream-slasher 2021.7.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stream-slasher 2021.7.14
File Size Uploaded Provenance Actions
stream-slasher-2021.7.14.tar.gz 8.1 kB Without provenance Details for stream-slasher-2021.7.14.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stream-slasher 2021.7.14
File Interpreter ABI Platform Actions
stream_slasher-2021.7.14-py3-none-any.whl Python 3 none any Details for stream_slasher-2021.7.14-py3-none-any.whl

Total release size: 16.2 kB

Release files / stream-slasher-2021.7.14.tar.gz

Download URL stream-slasher-2021.7.14.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
390aa2be29e6acdfb4e42304bedbe09a717643947b8fefd7e38c7105f6b30df3
BLAKE2b-256 checksum
How to use checksums
fe1e711d70a1233d28a05b20f9f1200079d1396e0acbf6997ff12c9759e8e9f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.10 Linux/5.4.0-91-generic

Release files / stream_slasher-2021.7.14-py3-none-any.whl

Download URL stream_slasher-2021.7.14-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
920e46e7cc75c288ac354d0f953eb2629dbb0b61636e690fbcee3e70de2acf03
BLAKE2b-256 checksum
How to use checksums
7ee9b2445d0e053bb06fc79bd5f6dfeaf15c19e065c1883d61458b0a711b326f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.10 Linux/5.4.0-91-generic

Security for stream-slasher 2021.7.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2021.7.14 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page