Skip to content
/ goffli Public

⚗️ Lua wrapper at top of FFMPEG API with nice progress bars and user friendly input arguments.

License

Notifications You must be signed in to change notification settings

wolfy-j/goffli

Repository files navigation

Goffli

GitHub release license Go Report Card Travis

Goffli is simple to use interface and FFmpeg CLI wrapper that offers the ability to convert video, audio, and other multimedia files and streams using small Lua programs which you can share over Github Gist.

Goffli

GIF

You can save and share any script with others. Every time you reuse it you will save all the time you spent in the past searching Google for ffmpeg bash scripts.

Installation

Make sure to install Golang 1.9 on your machine.

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

Or you can find binaries here.

Usage

By default, Goffli can only display media information about a given file:

goffli info video.mp4

If you are looking to extend the possibilities of Goffli's functionality, you can load snippets using a GitHub Gist url:

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

These snippets can then be used immediately:

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 you create above for others in the community.

Local snippets

You can also test your local Lua script without having to download it from GitHub Gists.

goffli run snippet.lua [args]

Coding the Snippet

Writing the code for the snippet is easy. You can utilize a set of functions embedded to a Lua machine in order to make it more user friendly.

Input functions

You can ask a user to enter a value

print(ask("Value"))

In order to validate a 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

In order to retrieve a name of a temp directory

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

In order to allocate a temporary file with a desired extension

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

FFmpeg functions

This will display a spinner

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

This will display a progress bar

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

Run Ffmpeg without showing any progress to a user

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

Get media and stream details

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

print(info.format.duration)

Display media file details

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

Returned result example.

Display media file streams

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

License:

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

About

⚗️ Lua wrapper at top of FFMPEG API with nice progress bars and user friendly input arguments.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published