twigen

Twitch VOD highlights generator


Keywords
Twitch
License
MIT
Install
pip install twigen==0.6

Documentation

twigen (beta)

is a Twitch VOD highlights generator that downloads the best moments of pasts streams. It also has options for downloading specific parts or the entire VOD.

How it works

twigen analizes chat data and selects the segments of the stream that had more messages per sample (by default, a sample is 60 seconds). Additionally, you can specify segments of the stream that you want to be included.

About the GUI

twigen uses a command-line interface. However, if it is called without arguments a (very simple) GUI will spawn. It is a command builder, that is, the options you choose in the GUI will be translated to a command that will run on a terminal (command prompt). Technically, a terminal is not needed for it to succeed, but the GUI closes when you press the OK button and you won't be able to see the progress or if some error happens.

gui

Use examples

This command will download the highlights of https://www.twitch.tv/videos/436057160 generating a 5 minutes (at least) video:

twigen --urls 436057160 --min 5

An important option for editors is --segs. This will generate small output files (instead of putting it all together) so that you can do some extra editing.

For small channels with small chat interaction, it can be useful to use --signal and --include:

twigen --urls 436176289 --min 10 --signal --include "0:0:0, 0:1:0"

this command will look for messages in chat that contain !twigen and include that moment in the highlights. --include "0:0:0, 0:1:0" guarantees that the first minute is included in the highlights. The include option accepts multiple intervals of time:

--include "0:0:0, 0:1:0; 0:20:0, 1:0:0"

It is also possible to generate highlights using multiple VODs:

twigen --urls 436176289,437203732,438054911 --min 15 --group --output twigen_highlights.mp4

List of options

  -h, --help            show this help message and exit
  -u URLS, --urls URLS  URLs or IDs of the VODs to process
  -q, --quiet           do not print what is being done
  -s SAMPLE, --sample SAMPLE
                        duration of each sample in seconds, default=60
  -d DELAY, --delay DELAY
                        start recording DELAY seconds early in each sample,
                        default=30
  -g, --group           process a list of urls into a single output file
  -l, --check           print how long the output file would be with this
                        options
  -T, --tmp             do not save dowloaded data to current directory
  -M, --muted           include muted portions of the VOD
  -i INCLUDE, --include INCLUDE
                        include the specified samples
  -Z, --signal          look for !twigen in chat messages and create a sample
                        of that moment
  -o OUTPUT, --output OUTPUT
                        name of the output file
  -S, --segs            do not concatenate samples
  -C, --nochat          do not download chat data, process included samples
                        only
  -m MIN, --min MIN     minimum length of the output file when generating
                        highlights
  -y HYPE, --hype HYPE  float number between [0,1] used by the highlights
                        generator for selecting samples, default=0.6

How to install

First, you need Python 3.7. On Linux, you should find it in your distro's packages. On Windows, download from the official web site.

Now, on your terminal/command prompt:

pip install twigen

or you might need to run:

python3.7 -m pip install twigen

Now you need to install ffmpeg. On Linux, your distro should have a package for it, something like:

sudo apt install ffmpeg

On Windows, download from the official web site.

Extract the .zip, rename the file to something like FFmpeg and paste it in C:\ Then open the command prompt and run:

setx PATH "C:\FFmpeg\ffmpeg-20190610-80e68ce-win64-static\bin;%PATH%"

so that ffmpeg can be called from the command prompt. Make sure that the folder inside ffmpeg has the name ffmpeg-20190610-80e68ce-win64-static, if not just modify the command with the name you have.

Now run:

twigen --help

you should see the help message from twigen.