Git Product home page Git Product logo

go-ffprobe's Introduction

go-ffprobe

Small library for executing an ffprobe process on a given file and getting an easy to use struct representing the returned ffprobe data.

Installation

go get gopkg.in/vansante/go-ffprobe.v2

Documentation

Take a look at the autogenerated documentation:

https://pkg.go.dev/gopkg.in/vansante/go-ffprobe.v2

Basic usage

To get a quick the quick data on a video file:

ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
defer cancelFn()

data, err := ffprobe.ProbeURL(ctx, "/path/to/file.mp4")
if err != nil {
    log.Panicf("Error getting data: %v", err)
}

To get the ffprobe data for a video file that is accessible via HTTP, you can use the same command, but with an HTTP URL.

To get the data of a file you have an io.Reader for, use:

ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
defer cancelFn()

fileReader, err := os.Open("/path/to/file.mp4")
if err != nil {
    log.Panicf("Error opening test file: %v", err)
}

data, err := ffprobe.ProbeReader(ctx, fileReader)
if err != nil {
    log.Panicf("Error getting data: %v", err)
}

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.