Skip to content
forked from wolfy-j/goffli

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

License

Notifications You must be signed in to change notification settings

spiralscout/goffli

 
 

Repository files navigation

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)

Display media file information

require("ffmpeg").probe(input, true)

Display media file streams

require("ffmpeg").probe(input, false, true)

Probe result example.

License:

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.6%
  • Shell 1.2%
  • Makefile 0.2%