Git Product home page Git Product logo

ffextractor's Introduction

ffextractor

multi-platfom cli tool for media extractor using ffmpeg

linux macos

ffmpeg license repo-size

commit activity ci codecov

Table of Contents

Features

  • extract movie/audio exclude silent parts
  • extract movie exclude blackout parts

Requirements

Install

go install github.com/MasahiroSakoda/ffextractor@latest

Commands

Available commands:

  • silent - extract media exclude silent parts
  • blackout - extract movie exclude blackout parts
  • config - configure options

ffextractor silent

extract media exclude silent parts

# extract media exclude silent parts (split & merge)
ffextractor silent path_to_file

# extract media exclude silent parts (split only)
ffextractor silent path_to_file split

# filter by extension
ffextractor silent path_to_dir extensions=mp4

# filter by regexp
ffextractor silent path_to_dir filter "*\.mp4"

ffextractor blackout

extract movie exclude silent parts

# extract media exclude silent parts (split & merge)
ffextractor blackout path_to_file

# extract media exclude silent parts (split only)
ffextractor blackout path_to_file split

# filter by extension
ffextractor blackout path_to_dir extensions mp4

# filter by regexp
ffextractor blackout path_to_dir filter "*\.mp4"

ffextractor config

configure options

ffextractor config overwrite false
ffextractor config annotation "_merged"

ffextractor config threshold 10
ffextractor config silence_duration 10.0
ffextractor config blackout_duration 10.0

Configuration

~/.config/ffextractor/config.toml

[file]
overwrite  = false     # Overwrite basefile
annotation = "_merged" # Annotation for merged file

[extract]
threshold = 10            # threshold to detect silence (dB) [negative value]
silence_duration  = 10.0  # ducration to detect silence (second)
blackout_duration = 10.0  # ducration to detect blackout (second)

[encode]
split_with_encode  = true # split with encoding or not
concat_with_encode = true # concat with encoding or not

ToDo

  • split media
  • merge media
  • config file

ffextractor's People

Contributors

masahirosakoda avatar

Watchers

 avatar  avatar

ffextractor's Issues

[Feature]: generate sub command

Description

  • generate ffextractor silent command by cobra-cli add silent
  • generate ffextractor blackout command by cobra-cli add blackout
  • generate ffextractor config command by cobra-cli add config

Motivation

to use cobra first time ever

Alternatives

No response

Additional context

No response

[Feature]: fix config test

Description

fix config test assert condition using viper

Motivation

to enhance test

Alternatives

No response

Additional context

No response

[Feature]: add cobra-cli files

Description

generated by following command

cobra-cli init

Motivation

to create cli app easily

Alternatives

No response

Additional context

No response

remove revive warning

Description

  • package comment
  • function comment
  • variable comment

Motivation

to remove annoying revive warning

Alternatives

No response

Additional context

No response

[Feature]: configure Bubble Tea UI

Description

Implement Elm architecture requirements

  • init
func (m model) Init() tea.Cmd {
	// Just return `nil`, which means "no I/O right now, please."
	return nil
}
  • Model
type Model struct {
	// implement bubble component
}
var _ tea.Model = (*Model)(nil)

func New(configFile string) *Model {
	return &Model{
		// implement bubble component
	}
}
  • Update
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
	switch msg := msg.(type) {

 	// Is it a key press?
	case tea.KeyMsg:

		// Cool, what was the actual key pressed?
		switch msg.String() {
 		// These keys should exit the program.
		case "ctrl+c", "q":
			return m, tea.Quit
		}
	default:
		return m, nil
	}
}
  • View
func (m model) View() string {
	// implement bubble View render part
}

Reference:
Goで簡単にTUI!Bubble Teaのススメ(アーキテクチャ編)

Motivation

to render UI with Elm easily

Alternatives

No response

Additional context

No response

[Feature]: Update Go version

Description

1.21.5 -> 1.22.0

Motivation

to keep golang version up to date

Alternatives

No response

Additional context

No response

[Feature]: support configuration with toml

Description

  • load cofiguration from $XDG_CONFIG_HOME/ffextractor/config.toml
  • create if not exist

Motivation

to use parmanent settings

Alternatives

No response

Additional context

No response

[Feature]: Add constants

Description

add constants to use variables

  • internal/constants/defaults.go
  • internal/constants/errors.go
  • internal/constants/media.go

Motivation

to avoid type same thing again

Alternatives

No response

Additional context

No response

[Feature]: detect silence & blackout with ffmpeg

Description

  • check ffmpeg installation
  • Detect Silence
ffmpeg -i path_to_file -af silencedetect=noise=-50dB:d=5.0 -f null -
  • Detect Blackout
ffmpeg -i path_to_file -vf blackdetect=d=5.0 -f null -

Motivation

to extract media exclude silent & blackout parts

Alternatives

No response

Additional context

No response

[Feature]: add testify module

Description

add github.com/stretchr/testify with following command

go get github.com/stretchr/testify

Motivation

to run CI

Alternatives

No response

Additional context

No response

[Feature]: configure custom styles

Description

apply custom style with github.com/charmbracelet/lipgloss

Motivation

to define beautiful TUI layout

Alternatives

No response

Additional context

No response

[Feature]: Update revive conig

Description

update revive.toml to avoid warning for now

Motivation

to remove annoying warning

Alternatives

No response

Additional context

No response

[Feature]: add GitHub Actions files

Description

add following files

  • .github/actions/setup.yml
  • .github/workflows/ci.yml
  • .github/workflows/release.yml

Motivation

to develop & run CI smoothly

Alternatives

No response

Additional context

No response

[Feature]: refactor extractor

Description

  • inactivate progress func for now
  • supress output with Silent(true)

Motivation

to improve extractor

Alternatives

No response

Additional context

No response

[Feature]: notify newer release

Description

notify newer release using golang.org/x/mod/semver

Motivation

to release product smoothly

Alternatives

No response

Additional context

No response

[Feature]: add Utility for file

Description

  • function to return file existance
  • function to confirm file is executable
  • function to get file list
  • function to get file list by extensions
  • function to get file list by regexp
  • function to create file
  • function to remove file

Motivation

to enable cache

Alternatives

No response

Additional context

No response

[Feature]: Display detected segments

Description

display detected segments with buble tea table

Motivation

to improve user experience

Alternatives

No response

Additional context

No response

[Feature]: refactor bubble tea

Description

  • internal/ui/model.go
    • add status variables
    • remove cmd
  • internal/ui/cmd.go
    • move tea.Cmd methods
  • internal/ui/view.go
    • loading message for detecting segments
    • loading message for splitting segments
    • loading message for concatenating segments
  • internal/ui/update.go
    • add condition for detecting/splitting/concateneting
  • fix main/err color

Motivation

to improve UI

Alternatives

No response

Additional context

No response

[Feature]: Add missing test for cobra

Description

  • add missing test using cobra
  • refactor to run test

target:

  • internal/cmd/silent.go
  • internal/cmd/blackout.go
  • internal/cmd/completion.go
  • internal/cmd/config.go

Motivation

to improve test coverage

Alternatives

No response

Additional context

No response

[Feature]: remove progress from TUI

Description

Progress is unnecessary because ffmpeg is synchronised processing.

Motivation

to simplify TUI

Alternatives

No response

Additional context

No response

[Feature]: configure revive

Description

add revive.toml

Motivation

to display diagnostics

Alternatives

No response

Additional context

No response

[Feature]: add coverage badge

Description

add codecov coverage badge
coverage > settings > badge

Motivation

to display coverage badge on README.md

Alternatives

No response

Additional context

No response

[Bug]: fix loading toml propery

Description

didn't load config from toml propery

Expected behavior

load config from toml properly

Actual behavior

config values are filled with 0

Steps to reproduce

load config

Screenshots

No response

Environment

macOS 13.6.1

Additional information

No response

[Feature]: add test for cmd

Description

  • internal/cmd/root.go

Motivation

to improve test coverage

Alternatives

No response

Additional context

No response

[Feature]: use ffmpeg library for golang

Description

  • use u2takey/ffmpeg-go instead of exec.Command("ffmpeg", args...)
  • move module ffmpeg -> extractor
  • display progress with bubble tea
    • probe
    • detect
    • split
    • concatenation

Motivation

to develop faster

Alternatives

No response

Additional context

No response

[Feature]: limit sub command argument

Description

limit sub command argument

  • ffextractor silent file_or_dir
    require 1 argument at least

  • ffextractor blackout file_or_dir
    require 1 argument at least

  • ffextractor config key value

    • ffextractor config overwrite bool_value
    • ffextractor config annotation "_suffix"
    • ffextractor config threshold int_value
    • ffextractor config silence_duration float_value
    • ffextractor config blackout_duration float_value

Motivation

to prevent wrong parameter

Alternatives

No response

Additional context

No response

[Feature]: add toml test

Description

add missing test for toml

Motivation

to improve coverage

Alternatives

No response

Additional context

No response

[Feature]: add time utility for ffmpeg

Description

  • convert time from ffmpeg stdout to float64
  • convert second (float64) to string

Motivation

to calc for ffmpeg extracting

Alternatives

No response

Additional context

No response

[Feature]: Update golang environment

Description

  • Update golang: 1.21.3 -> 1.21.5
  • Specify golang version using mise (.mise.toml)
  • Update dependencies

Motivation

to keep newer runtime environment

Alternatives

No response

Additional context

No response

[Feature]: generate completion files

Description

generate completion files with following commands

  • ffextractor completion bash >> ./completions/ffextractor.bash
  • ffextractor completion zsh >> ./completions/ffextractor.zsh
  • ffextractor completion fish >> ./completions/ffextractor.fish

Motivation

to complete command for now

Alternatives

No response

Additional context

No response

[Feature]: add ffmpeg installation test

Description

  • add FedericoCarboni/setup-ffmpeg@v2 into .github/workflows/ci.yml
    before run test

Motivation

to improve test coverage

Alternatives

No response

Additional context

No response

[Feature]: configure Makefile

Description

  • make deps for go get
  • make build for go build
  • make test for go test
  • make coverage for go test & go tool cover
  • make install to install /usr/local/bin
  • make run for go run
  • make clean for go clean
  • make tag for git tag
  • make release for goreleaser

Motivation

to improve comman line

Alternatives

No response

Additional context

No response

[Feature]: add error library

Description

add github.com/cockroachdb/errors

Motivation

to enhance development

Alternatives

No response

Additional context

No response

[Feature]: Update README.md

Description

  • Add repository size badge
  • fix wrong link
  • fix config default value

Motivation

renew config

Alternatives

No response

Additional context

No response

[Feature]: add `ffextractor completion` as sub command

Description

add sub command to generate shell completion
execute as below

  • ffextractor completion bash
  • ffextractor completion zsh
  • ffextractor completion fish

Motivation

to execute command usefully

Alternatives

No response

Additional context

No response

[Feature]: refine bubbletea ui

Description

  • move segment model
    internal/model -> internal/segment

  • add error detection

Motivation

to improve UI

Alternatives

No response

Additional context

No response

[Feature]: add cache utility

Description

add cache utility using github.com/mitchellh/mapstructure

Motivation

to load & store cache

Alternatives

No response

Additional context

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.