Skip to content

Commit f362879

Browse files
committed
Update README.md
- Make dependency info more actual - Add project integrations samples - Deprecate Meson until maintainer lookup
1 parent 0bb1367 commit f362879

2 files changed

Lines changed: 143 additions & 20 deletions

File tree

README.md

Lines changed: 142 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,38 @@ Wrapper for the FFmpeg that simplify usage it from C++ projects.
44

55
Currently covered next functionality:
66

7-
- Core helper & utility classes (AVFrame -> av::AudioSample & av::VideoFrame, AVRational -> av::Rational and so on)
7+
- Core helper & utility classes (`AVFrame``av::AudioSample` & `av::VideoFrame`, `AVRational``av::Rational` and so on)
88
- Container formats & contexts muxing and demuxing
99
- Codecs & codecs contexts: encoding and decoding
10-
- Streams (AVStream -> av::Stream)
10+
- Streams (`AVStream``av::Stream`)
1111
- Filters (audio & video): parsing from string, manual adding filters to the graph & other
1212
- SW Video & Audio resamplers
1313

1414
You can read the full documentation [here](https://h4tr3d.github.io/avcpp/).
1515

1616
## Requirements
1717

18-
- FFmpeg >= 2.0
19-
- libavformat >= 54.x.x
20-
- libavcodec >= 54.x.x
21-
- libavfilter >= 3.x.x
22-
- libavutil >= 51.x.x
23-
- libswscale >= 2.x.x
24-
- libswresample >= 0.x.x
25-
- libpostproc >= 52.x.x
26-
- GCC >= 5.0 (C++11 is required)
27-
- CMake (> 3.19) or Meson(> 50.0)
18+
- FFmpeg >= 4.0
19+
- libavformat >= 58.x.x
20+
- libavcodec >= 58.x.x
21+
- libavdevice >= 58.x.x
22+
- libavfilter >= 7.x.x
23+
- libavutil >= 56.x.x
24+
- libswscale >= 5.x.x
25+
- libswresample >= 3.x.x
26+
- libpostproc >= 55.x.x
27+
- GCC >= 9.0 (C++17 is required. [See](https://gcc.gnu.org/projects/cxx-status.html#cxx17), GCC from 6.0 may built code, but unchecked)
28+
- CMake (> 3.19)
2829

29-
### Debian, Ubuntu 19.10 and Linux Mint 20.x or newer
30+
>
31+
> [!NOTE]
32+
> Oldest versions of the FFmpeg (at least >=2.0) may be successfully built and work but is it not checked for now. Same notes valid for the GCC version from 6.0.
33+
34+
### Debian, Ubuntu 19.10+ and Linux Mint 20.x or newer
35+
36+
> [!NOTE]
37+
>
38+
> Build verification done only for oldest Ubuntu version provided by the GitHub Flow. You can look it [here](https://github.com/h4tr3d/avcpp/blob/master/.github/workflows/cmake-ci.yml#L25). For now, it is 22.04.
3039
3140
You should install FFmpeg packages from the deb-multimedia.org site:
3241

@@ -41,9 +50,13 @@ sudo apt-get install libavformat-dev \
4150
libavdevice-dev
4251
```
4352

44-
Note 1: I did not test building on Debian.
53+
> [!NOTE]
54+
>
55+
> **Note 1**: I did not test building on Debian.
4556
46-
Note 2: Debian Wheezy repo contains only FFmpeg 1.0.8. I tested building only with 2.x. So it is strongly recoment use Wheezy back-ports repo.
57+
> [!NOTE]
58+
>
59+
> **Note 2**: Debian Wheezy repo contains only FFmpeg 1.0.8. I tested building only with ~2.x~ 4.0. So it is strongly recommended use Wheezy back-ports repo.
4760
4861
### Ubuntu 18.04 and Linux Mint 19.x
4962

@@ -58,10 +71,7 @@ After that just install the same packages as above.
5871

5972
------
6073

61-
## Build
62-
63-
There are two ways to compile either with CMake or with meson.
64-
By default meson is faster, but if your project uses CMake, those instructions might be better for integration.
74+
## Build & Usage
6575

6676
### Building with CMake
6777

@@ -103,7 +113,119 @@ sudo make DESTDIR=<some_prefix> install
103113

104114
Refer to CMake documentation for more details that can cover some special cases.
105115

106-
### Building with meson
116+
#### Useful configure directives
117+
118+
- `AV_ENABLE_STATIC` - Bool, enable static library build, On by default.
119+
- `AV_ENABLE_SHARED` - Bool, enable shared library build, On by default.
120+
- `AV_BUILD_EXAMPLES` - Bool, enable examples build, On by default.
121+
- C++ related
122+
- `CMAKE_CXX_STANDARD` - Can be defined globally to override default C++ version. C++17 required at least.
123+
- FFmpeg related:
124+
- `FFMPEG_PKG_CONFIG_SUFFIX` - String, TBD
125+
- `PC_<component>_LIBRARY_DIRS` - Path, hint where FFmpeg component library looking
126+
- `PC_FFMPEG_LIBRARY_DIRS` - Path, hint where a whole FFmpeg libraries looking
127+
- `PC_<component>_INCLUDE_DIRS` - Path, hint where a FFmpeg component includes looking
128+
- `PC_FFMPEG_INCLUDE_DIRS` - Path, hint where a whole FFmpeg includes looking
129+
- `<component>` are:
130+
- `AVCODEC`
131+
- `AVDEVICE`
132+
- `AVFORMAT`
133+
- `AVFILTER`
134+
- `AVUTIL`
135+
- `POSTPROC`
136+
- `SWSCALE`
137+
- `SWRESAMPLE`
138+
139+
### Integrate to the CMake project as Git Submodule
140+
141+
AvCpp can be simple integrated into CMake-based project as Git submodule.
142+
143+
Just do something like:
144+
145+
```sh
146+
git submodule add https://github.com/h4tr3d/avcpp.git 3rdparty/avcpp
147+
```
148+
149+
And in the your CMakeLists.txt:
150+
151+
```cmake
152+
add_subdirectory(3rdparty/avcpp)
153+
```
154+
155+
AvCpp detects that it included as non-root projects and skips some steps, like installation.
156+
157+
CMake parameters pointed above may be sets before `add_subdirectory()`.
158+
159+
Than use via `target_link_libraries`:
160+
161+
```cmake
162+
target_link_libraries(prog PRIVATE avcpp::avcpp)
163+
```
164+
165+
### Integrate to the CMake project via FetchContent
166+
167+
Just do in your CMakeLists.txt:
168+
169+
```cmake
170+
include(FetchContent)
171+
FetchContent_Declare(
172+
avcpp
173+
GIT_REPOSITORY https://github.com/h4tr3d/avcpp.git
174+
GIT_TAG v2.8.0
175+
)
176+
FetchContent_MakeAvailable(avcpp)
177+
```
178+
179+
Than use via `target_link_libraries`:
180+
181+
```cmake
182+
target_link_libraries(prog PRIVATE avcpp::avcpp)
183+
```
184+
185+
CMake arguments can be set before `FetchContent_MakeAvailable` call:
186+
187+
```cmake
188+
FetchContent_Declare(
189+
avcpp
190+
...
191+
)
192+
set(AV_ENABLE_STATIC On)
193+
set(AV_ENABLE_SHARED Off)
194+
FetchContent_MakeAvailable(avcpp)
195+
```
196+
197+
### Use via Vcpkg
198+
199+
Just put into vcpkg.json:
200+
201+
```json
202+
{
203+
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
204+
"dependencies": [
205+
...
206+
"avcpp",
207+
...
208+
],
209+
"name": "your-app-name",
210+
"version-string": "0.0.1"
211+
}
212+
```
213+
214+
Than in the your CMakeLists.txt:
215+
216+
```cmake
217+
find_package(avcpp CONFIG REQUIRED)
218+
target_link_libraries(prog PRIVATE avcpp::avcpp)
219+
```
220+
221+
222+
223+
### Building with Meson
224+
225+
> [!CAUTION]
226+
>
227+
> CMake usage strongly recommended.
228+
> Meson build has no maintainer and broken for the last code. It is excluded from the CI builds.
107229
108230
Before you can begin with the building you have to clone the repository like this:
109231

cmake/FindFFmpeg.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
# AVUTIL
3535
# POSTPROC
3636
# SWSCALE
37+
# SWRESAMPLE
3738
#
3839
# the following variables will be defined
3940
#

0 commit comments

Comments
 (0)