Skip to content

Commit bd06e71

Browse files
authored
Merge pull request #12 from mutablelogic/ffmpeg61
Update to ffmpeg 61
2 parents 9aa5e2f + 0a2b66e commit bd06e71

File tree

142 files changed

+8955
-1046
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+8955
-1046
lines changed

Makefile

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,63 @@
22
GO=$(shell which go)
33
DOCKER=$(shell which docker)
44

5-
# Paths to locations, etc
6-
BUILD_DIR := "build"
7-
CMD_DIR := $(filter-out cmd/README.md, $(wildcard cmd/*))
8-
95
# Build flags
10-
BUILD_MODULE := $(shell go list -m)
11-
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GitSource=${BUILD_MODULE}
12-
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GitTag=$(shell git describe --tags)
13-
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GitBranch=$(shell git name-rev HEAD --name-only --always)
14-
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GitHash=$(shell git rev-parse HEAD)
15-
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GoBuildTime=$(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
6+
BUILD_MODULE := $(shell cat go.mod | head -1 | cut -d ' ' -f 2)
7+
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/version.GitSource=${BUILD_MODULE}
8+
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/version.GitTag=$(shell git describe --tags --always)
9+
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/version.GitBranch=$(shell git name-rev HEAD --name-only --always)
10+
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/version.GitHash=$(shell git rev-parse HEAD)
11+
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/version.GoBuildTime=$(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
1612
BUILD_FLAGS = -ldflags "-s -w $(BUILD_LD_FLAGS)"
1713

18-
all: clean test cmd
19-
20-
cmd: clean dependencies $(CMD_DIR)
14+
# Set OS and Architecture
15+
ARCH ?= $(shell arch | tr A-Z a-z | sed 's/x86_64/amd64/' | sed 's/i386/amd64/' | sed 's/armv7l/arm/' | sed 's/aarch64/arm64/')
16+
OS ?= $(shell uname | tr A-Z a-z)
17+
VERSION ?= $(shell git describe --tags --always | sed 's/^v//')
18+
DOCKER_REGISTRY ?= ghcr.io/mutablelogic
2119

22-
$(CMD_DIR): FORCE
23-
@echo Build cmd $(notdir $@)
24-
@${GO} build -o ${BUILD_DIR}/$(notdir $@) ${BUILD_FLAGS} ./$@
20+
# Paths to locations, etc
21+
BUILD_DIR := "build"
22+
CMD_DIR := $(filter-out cmd/ffmpeg/README.md, $(wildcard cmd/ffmpeg/*))
23+
BUILD_TAG := ${DOCKER_REGISTRY}/go-media-${OS}-${ARCH}:${VERSION}
2524

26-
$(PLUGIN_DIR): FORCE
27-
@echo Build plugin $(notdir $@)
28-
@${GO} build -buildmode=plugin -o ${BUILD_DIR}/$(notdir $@).plugin ${BUILD_FLAGS} ./$@
25+
all: clean cmds
2926

30-
FORCE:
27+
cmds: $(CMD_DIR)
3128

32-
docker:
33-
@echo Build docker image
29+
docker: docker-dep
30+
@echo build docker image: ${BUILD_TAG} for ${OS}/${ARCH}
3431
@${DOCKER} build \
35-
--tag go-media:$(shell git describe --tags) \
36-
--build-arg PLATFORM=$(shell ${GO} env GOOS) \
37-
--build-arg ARCH=$(shell ${GO} env GOARCH) \
38-
--build-arg VERSION=kinetic \
32+
--tag ${BUILD_TAG} \
33+
--build-arg ARCH=${ARCH} \
34+
--build-arg OS=${OS} \
35+
--build-arg SOURCE=${BUILD_MODULE} \
36+
--build-arg VERSION=${VERSION} \
3937
-f etc/docker/Dockerfile .
4038

41-
test: clean dependencies
42-
@echo Test sys/
43-
@${GO} test ./sys/...
44-
@echo Test pkg/
45-
@${GO} test ./pkg/...
39+
docker-push: docker-dep
40+
@echo push docker image: ${BUILD_TAG}
41+
@${DOCKER} push ${BUILD_TAG}
42+
43+
test: go-dep
44+
@echo Test
45+
@${GO} mod tidy
46+
@${GO} test ./sys/ffmpeg61
47+
48+
$(CMD_DIR): go-dep mkdir
49+
@echo Build cmd $(notdir $@)
50+
@${GO} build ${BUILD_FLAGS} -o ${BUILD_DIR}/$(notdir $@) ./$@
51+
52+
FORCE:
53+
54+
go-dep:
55+
@test -f "${GO}" && test -x "${GO}" || (echo "Missing go binary" && exit 1)
4656

47-
dependencies: mkdir
48-
ifeq (,${GO})
49-
$(error "Missing go binary")
50-
endif
57+
docker-dep:
58+
@test -f "${DOCKER}" && test -x "${DOCKER}" || (echo "Missing docker binary" && exit 1)
5159

5260
mkdir:
53-
@echo Mkdir
61+
@echo Mkdir ${BUILD_DIR}
5462
@install -d ${BUILD_DIR}
5563

5664
clean:

README.md

Lines changed: 25 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33

44
This module provides an interface for media services, including:
55

6-
* Bindings in golang for [ffmpeg 5.1](https://ffmpeg.org/);
7-
* Opening media files, devices and network sockets for reading
8-
and writing;
9-
* Retrieving metadata and artwork from audio and video media;
10-
* Re-multiplexing media files from one format to another;
11-
* Fingerprinting audio files to identify music.
6+
* Bindings in golang for [ffmpeg 6](https://ffmpeg.org/);
7+
* Opening media files, devices and network sockets for reading and writing;
8+
* Retrieving metadata and artwork from audio and video media;
9+
* Re-multiplexing media files from one format to another;
10+
* Fingerprinting audio files to identify music.
1211

1312
## Current Status
1413

@@ -17,66 +16,48 @@ you are interested in, please see below "Contributing & Distribution" below.
1716

1817
## Requirements
1918

20-
In order to build the examples, you'll need the library and header files for [ffmpeg 5.1](https://ffmpeg.org/download.html) installed. The `chromaprint` library is also required for fingerprinting audio files.
21-
22-
On Macintosh with [homebrew](http://bew.sh/), for example:
19+
In order to build the examples, you'll need the library and header files for [ffmpeg 6](https://ffmpeg.org/download.html) installed.
20+
The `chromaprint` library is also required for fingerprinting audio files. On Macintosh with [homebrew](http://bew.sh/), for example:
2321

2422
```bash
25-
brew install ffmpeg chromaprint make
23+
brew install ffmpeg@6 chromaprint make
2624
```
2725

2826
There are some examples in the `cmd` folder of the main repository on how to use
2927
the package. The various make targets are:
3028

31-
* `make all` will perform tests, build all examples and the backend API;
32-
* `make test` will perform tests;
33-
* `make cmd` will build example command-line tools into the `build` folder;
34-
* `make clean` will remove all build artifacts.
29+
* `make all` will perform tests, build all examples and the backend API;
30+
* `make test` will perform tests;
31+
* `make cmd` will build example command-line tools into the `build` folder;
32+
* `make clean` will remove all build artifacts.
33+
34+
There are also some targets to build a docker image:
35+
36+
* `DOCKER_REGISTRY=docker.io/user make docker` will build a docker image;
37+
* `DOCKER_REGISTRY=docker.io/user make docker-push` will push the docker image to the registry.
3538

3639
For example,
3740

3841
```bash
3942
git clone git@github.com:djthorpe/go-media.git
4043
cd go-media
41-
make
44+
DOCKER_REGISTRY=ghcr.io/mutablelogic make docker
4245
```
4346

4447
## Examples
4548

46-
There are two example [Command Line applications](https://github.com/mutablelogic/go-media/tree/master/cmd):
47-
48-
* `extractartwork` can be used to walk through a directory and extract artwork from media
49-
files and save the artwork into files;
50-
* `transcode` can be used to copy, re-mux and re-sample media files from one format to another.
51-
52-
You can compile both applications with `make cmd`which places the binaries into the `build` folder.
53-
Use the `-help` option on either application to see the options.
54-
55-
5649
## Media Transcoding
5750

58-
You can programmatically demultiplex, re-multiplex and re-sample media files using the following packages:
59-
60-
* `sys/ffmpeg51` provides the implementation of the lower-level function calls
61-
to ffmpeg. The documentation is [here](https://pkg.go.dev/github.com/mutablelogic/go-media/sys/ffmpeg51)
62-
* `pkg/media` provides the higher-level API for opening media files, reading,
63-
transcoding, resampling and writing media files. The interfaces and documentation
64-
are best read here:
65-
* [Audio](https://github.com/mutablelogic/go-media/blob/master/audio.go)
66-
* [Video](https://github.com/mutablelogic/go-media/blob/master/video.go)
67-
* [Media](https://github.com/mutablelogic/go-media/blob/master/media.go)
68-
* And [here](https://pkg.go.dev/github.com/mutablelogic/go-media/)
69-
7051
## Audio Fingerprinting
7152

7253
You can programmatically fingerprint audio files, compare fingerprints and identify music using the following packages:
7354

74-
* `sys/chromaprint` provides the implementation of the lower-level function calls
75-
to chromaprint. The documentation is [here](https://pkg.go.dev/github.com/mutablelogic/go-media/sys/chromaprint)
76-
* `pkg/chromaprint` provides the higher-level API for fingerprinting and identifying music. The documentation
77-
is [here](https://pkg.go.dev/github.com/mutablelogic/go-media/pkg/chromaprint).
55+
* `sys/chromaprint` provides the implementation of the lower-level function calls
56+
to chromaprint. The documentation is [here](https://pkg.go.dev/github.com/mutablelogic/go-media/sys/chromaprint)
57+
* `pkg/chromaprint` provides the higher-level API for fingerprinting and identifying music. The documentation
58+
is [here](https://pkg.go.dev/github.com/mutablelogic/go-media/pkg/chromaprint).
7859

79-
You'll need an API key in order to use the [AcoustID](https://acoustid.org/) service. You can get a key
60+
You'll need an API key in order to use the [AcoustID](https://acoustid.org/) service. You can get a key
8061
[here](https://acoustid.org/login).
8162

8263
## Contributing & Distribution
@@ -88,9 +69,9 @@ The license is Apache 2 so feel free to redistribute. Redistributions in either
8869
code or binary form must reproduce the copyright notice, and please link back to this
8970
repository for more information:
9071

91-
> Copyright (c) 2021-2023 David Thorpe, All rights reserved.
72+
> Copyright (c) 2021-2024 David Thorpe, All rights reserved.
9273
9374
## References
9475

95-
* https://ffmpeg.org/doxygen/5.1/index.html
76+
* https://ffmpeg.org/doxygen/6.1/index.html
9677

0 commit comments

Comments
 (0)