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.
Make sure to install Golang 1.9 at your machine.
go get "github.com/wolfy-j/goffli"
You can also find binaries here.
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
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.
You can also evaluate local lua script without downloading it from GitHub Gists.
goffli run snippet.lua [args]
Coding the snippet is easy, you can utilize set of functions embedded to Lua machine in order to make usage more user friendly.
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")
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"))
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.
The MIT License (MIT). Please see LICENSE
for more information.