go-media
go-media copied to clipboard
go media services
go-media
This module provides an interface for media services, including:
- Bindings in golang for ffmpeg 5.1;
- Opening media files, devices and network sockets for reading and writing;
- Retrieving metadata and artwork from audio and video media;
- Re-multiplexing media files from one format to another;
- Fingerprinting audio files to identify music.
Current Status
This module is currently in development and subject to change. If there are any specific features you are interested in, please see below "Contributing & Distribution" below.
Requirements
In order to build the examples, you'll need the library and header files for ffmpeg 5.1 installed. The chromaprint library is also required for fingerprinting audio files.
On Macintosh with homebrew, for example:
brew install ffmpeg chromaprint make
There are some examples in the cmd folder of the main repository on how to use
the package. The various make targets are:
make allwill perform tests, build all examples and the backend API;make testwill perform tests;make cmdwill build example command-line tools into thebuildfolder;make cleanwill remove all build artifacts.
For example,
git clone [email protected]:djthorpe/go-media.git
cd go-media
make
Examples
There are two example Command Line applications:
extractartworkcan be used to walk through a directory and extract artwork from media files and save the artwork into files;transcodecan be used to copy, re-mux and re-sample media files from one format to another.
You can compile both applications with make cmdwhich places the binaries into the build folder.
Use the -help option on either application to see the options.
Media Transcoding
You can programmatically demultiplex, re-multiplex and re-sample media files using the following packages:
sys/ffmpeg51provides the implementation of the lower-level function calls to ffmpeg. The documentation is herepkg/mediaprovides the higher-level API for opening media files, reading, transcoding, resampling and writing media files. The interfaces and documentation are best read here:
Audio Fingerprinting
You can programmatically fingerprint audio files, compare fingerprints and identify music using the following packages:
sys/chromaprintprovides the implementation of the lower-level function calls to chromaprint. The documentation is herepkg/chromaprintprovides the higher-level API for fingerprinting and identifying music. The documentation is here.
You'll need an API key in order to use the AcoustID service. You can get a key here.
Contributing & Distribution
This module is currently in development and subject to change.
Please do file feature requests and bugs here. The license is Apache 2 so feel free to redistribute. Redistributions in either source code or binary form must reproduce the copyright notice, and please link back to this repository for more information:
Copyright (c) 2021-2023 David Thorpe, All rights reserved.
References
- https://ffmpeg.org/doxygen/5.1/index.html