goffli

⚗️Goffli can program FFmpeg pipeline using colors and Lua.

Github stars Tracking Chart

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.

Main metrics

Overview
Name With Ownerwolfy-j/goffli
Primary LanguageGo
Program languageGo (Language Count: 3)
Platform
License:MIT License
所有者活动
Created At2018-04-29 18:37:23
Pushed At2018-06-29 20:38:32
Last Commit At2018-06-29 23:38:31
Release Count1
Last Release Namev1.0.0 (Posted on )
First Release Namev1.0.0 (Posted on )
用户参与
Stargazers Count107
Watchers Count8
Fork Count7
Commits Count105
Has Issues Enabled
Issues Count0
Issue Open Count0
Pull Requests Count2
Pull Requests Open Count0
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private