goffli

command module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2018 License: MIT Imports: 1 Imported by: 0

README

Goffli

GitHub release license Go Report Card Travis

Goffli is colorful and programmable (LUA) FFmpeg CLI wrapper with ability to share snippets over GitHub Gist.

When you hate to google ffmpeg bash scripts.

Goffli

Installation

Make sure to install Golang 1.9 at your machine.

go get "github.com/wolfy-j/goffli"

You can also find binaries here.

Usage

By default Goffli only able to display media information about a given file:

goffli info video.mp4

In order to extend Goffli functionality load snippet using GitHub Gist url:

goffli get https://gist.github.com/wolfy-j/d4ece481eb8c9bd8a438967d77603ce7 video2gif

You can use this snippet immediatelly:

goffli video2gif input.mp4 result.gif

Available Snippets

Snippet URL
copy https://gist.github.com/wolfy-j/8009a8b3be1004d933e105494c64c372
video2gif https://gist.github.com/wolfy-j/d4ece481eb8c9bd8a438967d77603ce7

Feel free to share your own snippets.

Local snippets

You can also evaluate local lua script without downloading it from GitHub Gists.

goffli run snippet.lua [args]

Coding the Snippet

Coding the snippet is easy, you can utilize set of functions embedded to Lua machine in order to make usage more user friendly.

Input functions

To ask user for the value (automatically populated thought command arguments)

print(ask("Value"))

To validate input value

local number = ask("Number", "number")
local float = ask("Number", "float")
local file = ask("File", "exists")
local not_empty = ask("Not Empty", "!empty")

Default values

local quality = ask("Quality", null, "32")
Temp files and directories

To get name of temp directory

local tmp = require("tmp")
print(tmp.dir())

To allocate temporary file with desired extension

local tmp = require("tmp")
print(tmp.file("mp4"))
FFmpeg functions

Convert with spinner

require("ffmpeg").run({
  "-i", input,
  "-vcodec", "copy", 
  "-y", output
}, "spinner")

Convert with progress bar

require("ffmpeg").run({
  "-i", input,
  "-vcodec", "copy", 
  "-y", output
}, "progress")

Convert without any indication

require("ffmpeg").run({
  "-i", input,
  "-vcodec", "copy", 
  "-y", output
}, "none")

Get media and stream information:

local info = require("ffmpeg").probe(input)

print(info.format.duration)

Probe result example.

License:

The MIT License (MIT). Please see LICENSE for more information.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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