Skip to content

Commit 03a5992

Browse files
author
Andrea Medeghini
committed
update readme
1 parent a14d092 commit 03a5992

1 file changed

Lines changed: 142 additions & 0 deletions

File tree

README.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,148 @@ Please note that the native library is statically liked with FFmpeg library unde
4343
You should have received a copy of the LGPL v2.1 license with FFmpeg4Java. See http://ffmpeg.org for more information about FFmpeg.
4444

4545

46+
## Binary distribution
47+
48+
FFmpeg4Java is available in Maven Central Repository and [GitHub](https://github.com/nextbreakpoint/ffmpeg4java).
49+
50+
If you are using Maven, add one of the following dependencies in your POM:
51+
52+
<dependency>
53+
<groupId>com.nextbreakpoint</groupId>
54+
<artifactId>com.nextbreakpoint.ffmepg4java.macos</artifactId>
55+
<version>7.0.1-1.0</version>
56+
</dependency>
57+
58+
<dependency>
59+
<groupId>com.nextbreakpoint</groupId>
60+
<artifactId>com.nextbreakpoint.ffmepg4java.linux</artifactId>
61+
<version>7.0.1-1.0</version>
62+
</dependency>
63+
64+
<dependency>
65+
<groupId>com.nextbreakpoint</groupId>
66+
<artifactId>com.nextbreakpoint.ffmepg4java.windows</artifactId>
67+
<version>7.0.1-1.0</version>
68+
</dependency>
69+
70+
71+
## Build
72+
73+
We recommend to use a Mac to build FFmpeg4Java because you can compile the library for all systems in one place, but that is not required.
74+
A Linux system con be used to compile the library for Linux and Windows (via cross compilation). You will need a Mac only to compile the library for MacOS.
75+
76+
We assume you have a Mac, however the same instructions work for Linux.
77+
Make sue you have installed Xcode command line tools and Docker (or just Docker if you are on Linux).
78+
We use Docker to simplify the toolchain configuration and ensure to have a consistent environment.
79+
80+
## Build the library for MacOS
81+
82+
Compile and install the library:
83+
84+
make -C ffmpeg4java-macos/native build-lib install
85+
86+
The library will be installed in the resources directory of the module:
87+
88+
ffmpeg4java-macos/src/main/resources/libffmpeg4java.dylib
89+
90+
Inspect the symbols exported by the library:
91+
92+
nm -gU ffmpeg4java-macos/src/main/resources/libffmpeg4java.dylib
93+
94+
Inspect the libraries linked with the library:
95+
96+
otool -L ffmpeg4java-macos/src/main/resources/libffmpeg4java.dylib
97+
98+
## Build the library for Linux
99+
100+
Compile and install the library:
101+
102+
make -C ffmpeg4java-linux/native build-lib install
103+
104+
The library will be installed in the resources directory of the module:
105+
106+
ffmpeg4java-linux/src/main/resources/libffmpeg4java.so
107+
108+
Inspect the symbols exported by the library:
109+
110+
objdump -t ffmpeg4java-linux/src/main/resources/libffmpeg4java.so
111+
112+
Inspect the libraries linked with the library:
113+
114+
objdump -p ffmpeg4java-linux/src/main/resources/libffmpeg4java.so | grep .so
115+
116+
## Build the library for Windows
117+
118+
Compile and install the library:
119+
120+
make -C ffmpeg4java-windows/native build-lib install
121+
122+
The library will be installed in the resources directory of the module:
123+
124+
ffmpeg4java-windows/src/main/resources/ffmpeg4java.dll
125+
126+
Inspect the symbols exported by the library:
127+
128+
objdump -t ffmpeg4java-windows/src/main/resources/ffmpeg4java.dll
129+
130+
Inspect the libraries linked with the library:
131+
132+
objdump -p ffmpeg4java-windows/src/main/resources/ffmpeg4java.dll | grep .dll
133+
134+
## Build the Java code
135+
136+
Compile and package the JARs:
137+
138+
make package
139+
140+
The artifacts will be created in the target directory of each module:
141+
142+
ffmpeg4java-macos/target/com.nextbreakpoint.ffmpeg4java.macos-7.0.1-1.0-x86_64.jar
143+
ffmpeg4java-linux/target/com.nextbreakpoint.ffmpeg4java.linux-7.0.1-1.0-x86_64.jar
144+
ffmpeg4java-windows/target/com.nextbreakpoint.ffmpeg4java.windows-7.0.1-1.0-x86_64.jar
145+
146+
Install the artifacts in your local Maven repository:
147+
148+
make install
149+
150+
## Test the Java code
151+
152+
Test the MacOS module (must be executed on MacOS):
153+
154+
make verify system=macos
155+
156+
Test the Linux module (must be executed on Linux):
157+
158+
make verify system=linux
159+
160+
Test the Windows module (must be executed on Windows):
161+
162+
make verify system=windows
163+
164+
## Generate Java code
165+
166+
The Java code of all modules is generated from the FFmpeg header files by jextract.
167+
168+
Download and install jextract for Java 22 for all target systems (see links below).
169+
170+
Edit the source file in the target module with the correct path of jextract and java.
171+
172+
Generate the code for MacOS (must be executed on MacOS):
173+
174+
eval $(cat ffmpeg4java-macos/source) && make extract system=macos
175+
176+
Generate the code for Linux (must be executed on Linux):
177+
178+
eval $(cat ffmpeg4java-linux/source) && make extract system=linux
179+
180+
Generate the code for Windows (must be executed on Windows):
181+
182+
eval $(cat ffmpeg4java-windows/source) && make extract system=windows
183+
184+
## Examples
185+
186+
See the code of the tests for an example of how to use the wrapper.
187+
46188
# Reference
47189

48190
Java Foreign Function and Memory API:

0 commit comments

Comments
 (0)