Help us shape the future of Go! Take the 2026 Go Developer Survey

goav

package module
v0.0.0-...-349ff85 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2016 License: MIT Imports: 0 Imported by: 0

README

ffgopeg Build Status

This go library provides bindings for ffmpeg. Its main goal is to make the ffmpeg library accessable in a way that feels natural in the go language. This library is based on giorgisio/goav and will differ in the following ways.

Current state

TL; DR: not stable

The renaming of funcitons is mostly complete. Although I have released version 1 I wouldn't call it stable yet. It is largely untested and many functions may not work as intended (meaning propable segmentation faults). If you discover any errors and/or have functions that are missing feel free to contribute! 😀

If you just want to decode audio files into float32 samples this project of mine could be for you. It provides a high level API for just that usecase, based on the ffgopeg library. A first version is going to come soon but feel free to checkout the develop-branch in the meantime ("checkout"... get it? 😆).

Usage

Installing or updating.

go get -u gopkg.in/targodan/ffgopeg.v1

This will install the latest version 1.n.m release. See Versioning.

The ffmpeg libraries are in theire own packages. If you know which ffmpeg function you want to use you can use this little webtool

Versioning

This project follows the semantic versioning scheme. That means if you use the gopkg.in link from above using go get -u should be safe and not break anything.

Mapping ffmpeg function names to go

The ffmpeg C-Functions are renamed following these rules:

  • Everything will be camel case: foo_bar ➡️ FooBar
  • Library-level functions like avcodec_register_all are going to be package level functions with the prefix removed: avcodec.RegisterAll
  • Functions that return something which is technically a bool will now return a go bool: see next example
  • Functions that modify or access a struct in a sort-of-OOP way will become methods: int av_codec_is_encoder(const AVCodec* codec) ➡️ func (codec *Codec) IsEncoder() bool
  • Allocating functions that are used as a constructor are going to be called NewXxx: avcodec_alloc_context3 ➡️ func NewContext() *CodecContext
  • Instead of int return codes go errors will be returned containing an error description (as returned by av_strerror) and the code.

In the future I will provide a little tool wich lets you search for the go-representation of a given ffmpeg C-function.

Contribute

If you get any errors using this library or some functions are missing please open an issue and/or fork, branch and file a pull request.

Also I could use some help with these things: If anyone has a good idea how to test the bindings I would be glad to hear it! I don't think it makes sense to test the behaviour of simple C calls as I assume these functions are already tested by ffmpeg. I don't know how I could test if the binding was successful without testing the behaviour though. Apart from that in order to test the behaviour I would need to dive way way way deeper into ffmpeg than I anticipate.

My TODO list

  • Do the actual renames
  • Document the whole thing
  • Implement the replacements for deprecated functions
  • Setup TravisCI
  • Test the library

Libraries

  • avcodec corresponds to the ffmpeg library: libavcodec [provides implementation of a wider range of codecs]
  • avformat corresponds to the ffmpeg library: libavformat [implements streaming protocols, container formats and basic I/O access]
  • avutil corresponds to the ffmpeg library: libavutil [includes hashers, decompressors and miscellaneous utility functions]
  • avfilter corresponds to the ffmpeg library: libavfilter [provides a mean to alter decoded Audio and Video through chain of filters]
  • avdevice corresponds to the ffmpeg library: libavdevice [provides an abstraction to access capture and playback devices]
  • swresample corresponds to the ffmpeg library: libswresample [implements audio mixing and resampling routines]
  • swscale corresponds to the ffmpeg library: libswscale [implements color conversion and scaling routines]

License

This library is under the MIT License

Documentation

Overview

Package goav contains golang binding for FFmpeg.

A comprehensive binding to the ffmpeg video/audio manipulation library: https://www.ffmpeg.org/

Contains:

libavcodec: encoding/decoding library
libavfilter: graph-based frame editing library
libavformat: I/O and muxing/demuxing library
libavdevice: special devices muxing/demuxing library
libavutil: common utility library
libswresample: audio resampling, format conversion and mixing
libpostproc: post processing library
libswscale: color conversion and scaling library

Directories

Path Synopsis
Package avcodec contains the codecs (decoders and encoders) provided by the libavcodec library
Package avcodec contains the codecs (decoders and encoders) provided by the libavcodec library
Package avdevice deals with the input and output devices provided by the libavdevice library The libavdevice library provides the same interface as libavformat.
Package avdevice deals with the input and output devices provided by the libavdevice library The libavdevice library provides the same interface as libavformat.
Package avfilter contains methods that deal with ffmpeg filters filters in the same linear chain are separated by commas, and distinct linear chains of filters are separated by semicolons.
Package avfilter contains methods that deal with ffmpeg filters filters in the same linear chain are separated by commas, and distinct linear chains of filters are separated by semicolons.
Package avformat provides some generic global options, which can be set on all the muxers and demuxers.
Package avformat provides some generic global options, which can be set on all the muxers and demuxers.
Package avutil is a utility library to aid portable multimedia programming.
Package avutil is a utility library to aid portable multimedia programming.
example
decodeAudio command
versions command
Package swresample provides a high-level interface to the libswresample library audio resampling utilities The process of changing the sampling rate of a discrete signal to obtain a new discrete representation of the underlying continuous signal.
Package swresample provides a high-level interface to the libswresample library audio resampling utilities The process of changing the sampling rate of a discrete signal to obtain a new discrete representation of the underlying continuous signal.
Package swscale performs highly optimized image scaling and colorspace and pixel format conversion operations.
Package swscale performs highly optimized image scaling and colorspace and pixel format conversion operations.

Jump to

Keyboard shortcuts

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