https://github.com/zergon321/reisen
A simple library to extract video and audio frames from media containers (based on libav).
https://github.com/zergon321/reisen
audio avcodec avformat avutil decoding ffmpeg ffmpeg-wrapper frame golang golang-library golang-package image libav libavcodec libavutil rgba sample samples sws video
Last synced: 11 months ago
JSON representation
A simple library to extract video and audio frames from media containers (based on libav).
- Host: GitHub
- URL: https://github.com/zergon321/reisen
- Owner: zergon321
- License: mit
- Archived: true
- Created: 2021-08-25T00:48:10.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-27T01:42:50.000Z (almost 3 years ago)
- Last Synced: 2024-11-15T20:36:38.815Z (over 1 year ago)
- Topics: audio, avcodec, avformat, avutil, decoding, ffmpeg, ffmpeg-wrapper, frame, golang, golang-library, golang-package, image, libav, libavcodec, libavutil, rgba, sample, samples, sws, video
- Language: Go
- Homepage:
- Size: 37.8 MB
- Stars: 137
- Watchers: 5
- Forks: 23
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Reisen [](https://pkg.go.dev/github.com/zergon321/reisen)
A simple library to extract video and audio frames from media containers (based on **libav**, i.e. **ffmpeg**).
## Dependencies
The library requires **libav** components to work:
- **libavformat**
- **libavcodec**
- **libavutil**
- **libswresample**
- **libswscale**
For **Arch**-based **Linux** distributions:
```bash
sudo pacman -S ffmpeg
```
For **Debian**-based **Linux** distributions:
```bash
sudo add-apt-repository ppa:savoury1/ffmpeg4
sudo apt install libswscale-dev libavcodec-dev libavformat-dev libswresample-dev libavutil-dev
```
For **macOS**:
```bash
brew install ffmpeg
```
For **Windows** see the [detailed tutorial](https://medium.com/@maximgradan/how-to-easily-bundle-your-cgo-application-for-windows-8515d2b19f1e).
## Installation
Just casually run this command:
```bash
go get github.com/zergon321/reisen
```
## Usage
Any media file is composed of streams containing media data, e.g. audio, video and subtitles. The whole presentation data of the file is divided into packets. Each packet belongs to one of the streams and represents a single frame of its data. The process of decoding implies reading packets and decoding them into either video frames or audio frames.
The library provides read video frames as **RGBA** pictures. The audio samples are provided as raw byte slices in the format of `AV_SAMPLE_FMT_DBL` (i.e. 8 bytes per sample for one channel, the data type is `float64`). The channel layout is stereo (2 channels). The byte order is little-endian. The detailed scheme of the audio samples sequence is given below.

You are welcome to look at the [examples](https://github.com/zergon321/reisen/tree/master/examples) to understand how to work with the library. Also please take a look at the detailed [tutorial](https://medium.com/@maximgradan/playing-videos-with-golang-83e67447b111).