mediainfo

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

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

README

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=)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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