Golang bindings for libmediainfo
Go C
Latest commit 29d57b2 Dec 24, 2015 @zhulik .gitignore update
Permalink
Failed to load latest commit information.
testdata Tests added Dec 15, 2015
.gitignore .gitignore update Dec 24, 2015
LICENSE Initial commit Dec 13, 2015
README.md readme and test example added Dec 20, 2015
go_mediainfo.h Refactorings Dec 15, 2015
mediainfo.go C memory management fixes Dec 21, 2015
mediainfo_test.go .gitignore update Dec 24, 2015

README.md

mediainfo

Golang binding for libmediainfo

Duration, Bitrate, Codec, Streams and a lot of other meta-information about media files can be extracted through it.

For now supports only media files with one stream. Bindings for MediaInfoList is not provided. It can be easy fixed if anybody ask me.

Works through MediaInfoDLL/MediaInfoDLL.h(dynamic load and so on), so your mediainfo installation should has it.

Supports direct reading files by name and reading data from []byte buffers(without copying it for C calls).

Documentation for libmediainfo is poor and ascetic, can be found here.

Your advices and suggestions are welcome!

Example

package main

import (
    "fmt"
    "github.com/zhulik/go_mediainfo"
    "io/ioutil"
    "os"
)

func main() {
    f, err := os.Open(os.Args[1])
    if err != nil {
        panic(err)
    }
    bytes, err := ioutil.ReadAll(f)
    if err != nil {
        panic(err)
    }

    mi := mediainfo.NewMediaInfo()
    err = mi.OpenMemory(bytes)
    if err != nil {
        panic(err)
    }
    fmt.Println(mi.AvailableParameters()) // Print all supported params for Get
    fmt.Println(mi.Get("BitRate")) // Print bitrate
}

Read the documentation for other functions

Contributing

You know=)