goffli

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

Github星跟踪图

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.

主要指标

概览
名称与所有者wolfy-j/goffli
主编程语言Go
编程语言Go (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2018-04-29 18:37:23
推送于2018-06-29 20:38:32
最后一次提交2018-06-29 23:38:31
发布数1
最新版本名称v1.0.0 (发布于 )
第一版名称v1.0.0 (发布于 )
用户参与
星数107
关注者数8
派生数7
提交数105
已启用问题?
问题数0
打开的问题数0
拉请求数2
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?