package module
Version: v0.0.0-...-29d57b2 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2015 License: MIT Imports: 5 Imported by: 0



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!


package main

import (

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

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

Read the documentation for other functions


You know=)




This section is empty.


This section is empty.


This section is empty.


type MediaInfo

type MediaInfo struct {
	// contains filtered or unexported fields

MediaInfo - represents MediaInfo class, all interaction with libmediainfo through it

func NewMediaInfo

func NewMediaInfo() *MediaInfo

NewMediaInfo - constructs new MediaInfo

func (*MediaInfo) AvailableParameters

func (mi *MediaInfo) AvailableParameters() string

AvailableParameters returns string with all available Get params and it's descriptions

func (*MediaInfo) Close

func (mi *MediaInfo) Close()

Close - closes file

func (*MediaInfo) Codec

func (mi *MediaInfo) Codec() string

Codec returns file codec

func (*MediaInfo) Duration

func (mi *MediaInfo) Duration() int

Duration returns file duration

func (*MediaInfo) Format

func (mi *MediaInfo) Format() string

Format returns file codec

func (*MediaInfo) Get

func (mi *MediaInfo) Get(param string) (result string)

Get - allow to read info from file

func (*MediaInfo) Inform

func (mi *MediaInfo) Inform() (result string)

Inform returns string with summary file information, like mediainfo util

func (*MediaInfo) OpenFile

func (mi *MediaInfo) OpenFile(path string) error

OpenFile - opens file

func (*MediaInfo) OpenMemory

func (mi *MediaInfo) OpenMemory(bytes []byte) error

OpenMemory - opens memory buffer

func (*MediaInfo) Option

func (mi *MediaInfo) Option(option string, value string) (result string)

Option configure or get information about MediaInfoLib

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL