{"id":19210422,"url":"https://github.com/itchio/goff","last_synced_at":"2025-07-04T10:34:07.079Z","repository":{"id":75129215,"uuid":"167570852","full_name":"itchio/goff","owner":"itchio","description":"🍿 Another take on Go FFmpeg bindings","archived":false,"fork":false,"pushed_at":"2020-03-03T20:51:31.000Z","size":315,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-12T19:28:49.308Z","etag":null,"topics":["audio","bindings","ffmpeg","golang","transcoding","video"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itchio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-25T15:42:23.000Z","updated_at":"2023-02-18T20:03:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"7f9dc4b1-5e60-4bab-8ef0-160c9e24cff3","html_url":"https://github.com/itchio/goff","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/itchio/goff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itchio%2Fgoff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itchio%2Fgoff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itchio%2Fgoff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itchio%2Fgoff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itchio","download_url":"https://codeload.github.com/itchio/goff/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itchio%2Fgoff/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263493378,"owners_count":23475184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","bindings","ffmpeg","golang","transcoding","video"],"created_at":"2024-11-09T13:36:04.482Z","updated_at":"2025-07-04T10:34:07.050Z","avatar_url":"https://github.com/itchio.png","language":"Go","readme":"\n[![Build Status](https://travis-ci.org/itchio/goff.svg?branch=master)](https://travis-ci.org/itchio/goff)\n[![Go Report Card](https://goreportcard.com/badge/github.com/itchio/goff)](https://goreportcard.com/report/github.com/itchio/goff)\n![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)\n\n# goff\n\ngoff binds a subset of the FFmpeg libraries (avformat, avcodec, avutil, swscale, etc.)\n\n### Mission statement\n\nAt the time of this writing, there's a dozen takes on Go/FFmpeg, most of\nwhich are forks of some other projects.\n\nAfter careful examination, it appears worthwhile to contribute a fresh take\nto the ecosystem that emphasizes correctness, forgoes deprecated functions\nand types, tries to stick to a friendly naming convention, and does not\nattempt to find universal high-level wrappers (besides type aliases, see\nbelow).\n\n### Contributing\n\nIf the mission statement above resonates with you, and you would like to add\nmissing types/constants/functions to goff, feel free to submit small pull\nrequests, that add only a handful of related type/functions at a time.\n\nTry to write contributions in the style of the original codebase - if you\nhave questions, open a GitHub issue to get an answer.\n\n### Prerequisites\n\ngoff is currently based on FFmpeg 4.1.\n\nThe `vendor-all.sh` script is provided to download, extract, configure \n(with an opinionated set of build flags), and install ffmpeg and x264\ninto `vendor_c`.\n\nThat script is enough to pass the integration tests, but it might be missing\nfeatures you might need :)\n\nAfter that, `PKG_CONFIG_PATH` still needs to be set properly, which\n`source vendor-env.sh` achieves (you could put that in your `.envrc`,\nusing \u003chttps://direnv.net/\u003e is a good idea here).\n\nTo run binaries compiled against the libs installed by `vendor-all.sh`,\n`LD_LIBRARY_PATH` needs to be set. Again, `source vendor-env.sh` takes care\nof that.\n\n### Design: Packages\n\nTechnically, avformat, avcodec, avutil are separate libraries - they\nhave separate headers and separate binaries.\n\nHowever, due to how cgo works, and because some types are shared\nacross all those libraries, goff exports only a single package.\n\n### Design: Types\n\nGo types are used to prevent misuse whenever possible.\n\nFor example, enums aren't `int`, but `SampleFormat`.\n\nType aliases are used to define functions on them - for example,\n`SampleFormat` implements `String()`.\n\nWhenever possible, functions are written as methods on a type. For example,\nthe `CodecID` has a `FindDecoder()` method, whereas\n\nGetters and setters are made available for types based on FFmpeg C structs,\nsee `frame.Width()` and `frame.SetWidth()`, for example. Hopefully those\nget inlined by the go compiler!\n\n### Design: Comments\n\nWhenever a Doxygen comment is available for a type, constant, or function,\nit is copy/pasted almost as-is to Godoc.\n\nFunctions/type names mentioned in comments are not rewritten, and are in C style.\n\n### Design: Timings (pts/dts)\n\nTimings (presentation timestamps, durations) in FFmpeg are expressed\nas int64, in relation to a fractional timebase.\n\nIn goff, timebases are of type `Rational`, and `Timing` values can\nbe converted to an (approximate) `time.Duration`. Which is useful\nfor human display purposes, but not for internal computation.\n\n### Design: Frame (Data and Linesize)\n\nIn FFmpeg, video frames may have as many as eight planes. RGBA video\nframes typically have only one plane, with interleaved Red, Green, Blue, and Alpha value. Whereas planar formats, like YUV420P, have three planes: one for Y, one for U, one for V.\n\nTechnically, the type of `Frame.data` is `[8]*uint8`. However, this\nis incredibly hard to use and surprisingly easy to mess up. So, goff\nships with the types `Planes` and `Plane`. These are used in the bindings\nfor swscale functions as well, preventing incorrect usage.\n\nAdditionally, `Frame` comes with a `PlaneData(i int)` getter, which directly\nreturns a slice (`[]uint8`) of the right capacity \u0026 length. This is the most\npractical way to access raw pixel data.\n\n### Design: Memory management\n\nUsers of goff should take care of allocating, initializing, and deallocating everything\nproperly. No finalizers are set, so, if you don't free something, you're leaking memory!\n\n### License\n\ngoff is MIT-licensed, but FFmpeg has LGPL and GPL components.\n\nSee \u003chttps://ffmpeg.org/legal.html\u003e for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitchio%2Fgoff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitchio%2Fgoff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitchio%2Fgoff/lists"}