skiptro

package module
v0.0.0-...-7ee234d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2020 License: MIT Imports: 22 Imported by: 0

README

skiptro

Ever find yourself watching your non-pirated media and wishing it has the Netflix "skip intro" button? Well, this is as close it gets.

skiptro analyzes your media library and tries to find common sequence in the first 5 minutes of the files. Then, it creates an EDL file (and .m3u playlist) which most players know how to interpret to skip to a particular time in the media file.

Usage

To create skip file for the "target" file by comparing it to the "source" file:

skiptro -source TheOffice/S01/E02.mp4 -target TheOffice/S01/E03.mp4

If using VLC, use the .m3u file produced to auto-skip the intro. Kodi will automatically detect the EDL file produced and skip the intro accordingly.

Flags

Flag Description Default
duration Length of search time 10m
hashtype Hash algorithm to be used (perception, difference, average) difference
fps Samples per second to extract for comparison 3
tolerance Similarity between frames (lower = more similar) 15
workers Workers to spin for JPEG processing NumCPU (ex. 8)
skipfile Create EDL and M3U skip files next to the target true
debug Profile and output debugging artifacts false

Status

Not suitable for mass library usage yet. Can be used to manually create the skip files.

Features missing

  • Full directory processing
  • Daemon mode which scans for new files and processes them automatically

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugImage

func DebugImage(scene Scene, fps int)

func EDL

func EDL(scene Scene) []byte

func M3U

func M3U(scene Scene, filename string) []byte

func NewReader

func NewReader(ctx context.Context, r io.Reader) io.Reader

func ProfileAndTrace

func ProfileAndTrace() (stopCpuFunc func(), stopTraceFunc func(), err error)

Types

type Config

type Config struct {
	Duration  time.Duration
	HashFunc  *HashFunc
	Source    string
	Target    string
	Tolerance int
	Workers   int
	FPS       int
	SkipFile  bool
	Debug     bool
}

func (*Config) Parse

func (c *Config) Parse() error

type HashExtractor

type HashExtractor struct {
	HashFunc    HashFunc
	FPS         int
	WorkerCount int
	// contains filtered or unexported fields
}

func NewExtractor

func NewExtractor(f *HashFunc, fps int, workers int) *HashExtractor

func (*HashExtractor) Hashes

func (h *HashExtractor) Hashes(filename string, at time.Duration, duration time.Duration) ([]*goimagehash.ImageHash, error)

Hashes returns hashed images from a video file

type HashFunc

type HashFunc func(image.Image) (*goimagehash.ImageHash, error)
var (
	HashDifference HashFunc = goimagehash.DifferenceHash
	HashPerception HashFunc = goimagehash.PerceptionHash
	HashAverage    HashFunc = goimagehash.AverageHash
)

type Metadata

type Metadata struct {
	Filename    string
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	PixelFormat string `json:"pix_fmt"`
	FrameRate   float64
	Duration    time.Duration
}

func ExtractMetadata

func ExtractMetadata(filename string) (Metadata, error)

func (*Metadata) UnmarshalJSON

func (m *Metadata) UnmarshalJSON(data []byte) error

type Scene

type Scene struct {
	Start      time.Duration
	End        time.Duration
	Similarity Similarity
}

func FindLongestScene

func FindLongestScene(source, target []*goimagehash.ImageHash, tolerance int, duration time.Duration) (Scene, error)

FindLongestScene returns the longest matching scene between two TODO Return hash frames of the intro in the scene

type Similarity

type Similarity struct {
	Matrix     [][]bool
	StartIndex int
	EndIndex   int
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL