Skip to content

Commit fe731b2

Browse files
author
Andrea Medeghini
committed
update readme
1 parent af6ef19 commit fe731b2

1 file changed

Lines changed: 110 additions & 22 deletions

File tree

README.md

Lines changed: 110 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ FFmpeg4Java is distributed under the terms of BSD 3-Clause License.
3838

3939
## Notice
4040

41-
FFmpeg4Java is distributed as JAR file which contains Java classes and a native library. The native library must be installed in the library path of the Java runtime.
41+
FFmpeg4Java is distributed as independent JAR files, one for each supported operating system.
42+
Each JAR file contains a native library which must be installed in the library path of the Java runtime.
43+
4244
Please note that the native library is statically liked with FFmpeg library under the terms of GNU Lesser General Public License, version 2.1.
4345
You should have received a copy of the LGPL v2.1 license with FFmpeg4Java. See http://ffmpeg.org for more information about FFmpeg.
4446

4547

46-
## Binary distribution
48+
## Get binaries
4749

4850
FFmpeg4Java is available in Maven Central Repository and [GitHub](https://github.com/nextbreakpoint/ffmpeg4java).
4951

@@ -67,17 +69,102 @@ If you are using Maven, add one of the following dependencies in your POM:
6769
<version>7.0.1-1.0</version>
6870
</dependency>
6971

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
72+
Also, add one of the following to download the native library:
73+
74+
<plugin>
75+
<groupId>org.apache.maven.plugins</groupId>
76+
<artifactId>maven-dependency-plugin</artifactId>
77+
<executions>
78+
<execution>
79+
<id>copy-lib</id>
80+
<phase>package</phase>
81+
<goals>
82+
<goal>unpack</goal>
83+
</goals>
84+
<configuration>
85+
<artifactItems>
86+
<artifactItem>
87+
<groupId>com.nextbreakpoint</groupId>
88+
<artifactId>com.nextbreakpoint.ffmpeg4java.macos</artifactId>
89+
<classifier>x86_64</classifier>
90+
<type>jar</type>
91+
<overWrite>true</overWrite>
92+
<outputDirectory>${project.build.directory}/lib</outputDirectory>
93+
</artifactItem>
94+
</artifactItems>
95+
<includes>**/*.dylib</includes>
96+
</configuration>
97+
</execution>
98+
</executions>
99+
</plugin>
100+
101+
<plugin>
102+
<groupId>org.apache.maven.plugins</groupId>
103+
<artifactId>maven-dependency-plugin</artifactId>
104+
<executions>
105+
<execution>
106+
<id>copy-lib</id>
107+
<phase>package</phase>
108+
<goals>
109+
<goal>unpack</goal>
110+
</goals>
111+
<configuration>
112+
<artifactItems>
113+
<artifactItem>
114+
<groupId>com.nextbreakpoint</groupId>
115+
<artifactId>com.nextbreakpoint.ffmpeg4java.linux</artifactId>
116+
<classifier>x86_64</classifier>
117+
<type>jar</type>
118+
<overWrite>true</overWrite>
119+
<outputDirectory>${project.build.directory}/lib</outputDirectory>
120+
</artifactItem>
121+
</artifactItems>
122+
<includes>**/*.so</includes>
123+
</configuration>
124+
</execution>
125+
</executions>
126+
</plugin>
127+
128+
<plugin>
129+
<groupId>org.apache.maven.plugins</groupId>
130+
<artifactId>maven-dependency-plugin</artifactId>
131+
<executions>
132+
<execution>
133+
<id>copy-lib</id>
134+
<phase>package</phase>
135+
<goals>
136+
<goal>unpack</goal>
137+
</goals>
138+
<configuration>
139+
<artifactItems>
140+
<artifactItem>
141+
<groupId>com.nextbreakpoint</groupId>
142+
<artifactId>com.nextbreakpoint.ffmpeg4java.windows</artifactId>
143+
<classifier>x86_64</classifier>
144+
<type>jar</type>
145+
<overWrite>true</overWrite>
146+
<outputDirectory>${project.build.directory}/lib</outputDirectory>
147+
</artifactItem>
148+
</artifactItems>
149+
<includes>**/*.dll</includes>
150+
</configuration>
151+
</execution>
152+
</executions>
153+
</plugin>
154+
155+
156+
## Build libraries
157+
158+
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 strictly required.
159+
A Linux system can be used to compile the library for Linux and Windows (via cross compilation), and use a Mac system only to compile the library for MacOS.
160+
161+
We assume you have a Mac, however the same build instructions work for Linux (but only for compiling the library for Linux and Windows).
162+
163+
Make sue you have installed Xcode command line tools (only for MacOS), Docker, git, make, maven, and Java 22.
164+
165+
We use Docker to simplify the toolchain configuration and ensure to have a consistent environment
166+
167+
### Build library for MacOS
81168

82169
Compile and install the library:
83170

@@ -95,7 +182,7 @@ Inspect the libraries linked with the library:
95182

96183
otool -L ffmpeg4java-macos/src/main/resources/libffmpeg4java.dylib
97184

98-
## Build the library for Linux
185+
### Build library for Linux
99186

100187
Compile and install the library:
101188

@@ -113,7 +200,7 @@ Inspect the libraries linked with the library:
113200

114201
objdump -p ffmpeg4java-linux/src/main/resources/libffmpeg4java.so | grep .so
115202

116-
## Build the library for Windows
203+
### Build library for Windows
117204

118205
Compile and install the library:
119206

@@ -131,7 +218,7 @@ Inspect the libraries linked with the library:
131218

132219
objdump -p ffmpeg4java-windows/src/main/resources/ffmpeg4java.dll | grep .dll
133220

134-
## Build the Java code
221+
## Build Java code
135222

136223
Compile and package the JARs:
137224

@@ -147,7 +234,7 @@ Install the artifacts in your local Maven repository:
147234

148235
make install
149236

150-
## Test the Java code
237+
## Test Java code
151238

152239
Test the MacOS module (must be executed on MacOS):
153240

@@ -161,13 +248,13 @@ Test the Windows module (must be executed on Windows):
161248

162249
make verify system=windows
163250

164-
## Generate Java code
251+
## Generate Java code (only if you know what you are doing)
165252

166253
The Java code of all modules is generated from the FFmpeg header files by jextract.
167254

168255
Download and install jextract for Java 22 for all target systems (see links below).
169256

170-
Edit the source file in the target module with the correct path of jextract and java.
257+
Edit the source file in the target module updating the path of jextract and java.
171258

172259
Generate the code for MacOS (must be executed on MacOS):
173260

@@ -182,12 +269,13 @@ Generate the code for Windows (must be executed on Windows):
182269
eval $(cat ffmpeg4java-windows/source) && make extract system=windows
183270

184271

185-
# Examples
272+
## Code examples
186273

187-
See the code of the tests for an example of how to use the wrapper.
274+
A simple example is provided for each supported system.
275+
Look at the POM files for details about how to download the native library and execute the code.
188276

189277

190-
# Reference
278+
## References
191279

192280
Java Foreign Function and Memory API:
193281
https://openjdk.org/jeps/454

0 commit comments

Comments
 (0)