Giter Club home page Giter Club logo

goffli's Introduction

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

You can save and share this 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.

goffli's People

Contributors

spiralscout avatar wolfy-j avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.