Skip to content

Commit

Permalink
update to ffmpeg 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bradh committed Jan 15, 2022
1 parent fb6afbd commit fa27b96
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 52 deletions.
25 changes: 12 additions & 13 deletions ffmpeg/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
JavaCPP Presets for FFmpeg
==========================
# JavaCPP Presets for FFmpeg

[![Gitter](https://badges.gitter.im/bytedeco/javacpp.svg)](https://gitter.im/bytedeco/javacpp) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.bytedeco/ffmpeg/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.bytedeco/ffmpeg) [![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/https/oss.sonatype.org/org.bytedeco/ffmpeg.svg)](http://bytedeco.org/builds/)
<sup>Build status for all platforms:</sup> [![ffmpeg](https://github.com/bytedeco/javacpp-presets/workflows/ffmpeg/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Affmpeg) <sup>Commercial support:</sup> [![xscode](https://img.shields.io/badge/Available%20on-xs%3Acode-blue?style=?style=plastic&logo=appveyor&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF////////VXz1bAAAAAJ0Uk5T/wDltzBKAAAAlUlEQVR42uzXSwqAMAwE0Mn9L+3Ggtgkk35QwcnSJo9S+yGwM9DCooCbgn4YrJ4CIPUcQF7/XSBbx2TEz4sAZ2q1RAECBAiYBlCtvwN+KiYAlG7UDGj59MViT9hOwEqAhYCtAsUZvL6I6W8c2wcbd+LIWSCHSTeSAAECngN4xxIDSK9f4B9t377Wd7H5Nt7/Xz8eAgwAvesLRjYYPuUAAAAASUVORK5CYII=)](https://xscode.com/bytedeco/javacpp-presets)

## Introduction

Introduction
------------
This directory contains the JavaCPP Presets module for:

* FFmpeg 4.4.1 http://ffmpeg.org/
* FFmpeg 5.0 http://ffmpeg.org/

Please refer to the parent README.md file for more detailed information about the JavaCPP Presets.

## Documentation

Documentation
-------------
Java API documentation is available here:

* http://bytedeco.org/javacpp-presets/ffmpeg/apidocs/

## Sample Usage

Sample Usage
------------
Here is a simple example of FFmpeg ported to Java from this C source file:

* https://github.com/monday0rsunday/ffmpeg-tutorial/blob/master/002_read_few_frame.c
* https://github.com/monday0rsunday/ffmpeg-tutorial/blob/master/002_read_few_frame.c

We can use [Maven 3](http://maven.apache.org/) to download and install automatically all the class files as well as the native binaries. To run this sample code, after creating the `pom.xml` and `ReadFewFrame.java` source files below, simply execute on the command line:

```bash
$ mvn compile exec:java -Dexec.args="myvideofile.mpg"
mvn compile exec:java -Dexec.args="myvideofile.mpg"
```

### The `pom.xml` build file

```xml
<project>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -46,14 +44,14 @@ We can use [Maven 3](http://maven.apache.org/) to download and install automatic
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg-platform</artifactId>
<version>4.4.1-1.5.7-SNAPSHOT</version>
<version>5.0-1.5.7-SNAPSHOT</version>
</dependency>

<!-- Optional GPL builds with (almost) everything enabled -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg-platform-gpl</artifactId>
<version>4.4.1-1.5.7-SNAPSHOT</version>
<version>5.0-1.5.7-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
Expand All @@ -63,6 +61,7 @@ We can use [Maven 3](http://maven.apache.org/) to download and install automatic
```

### The `ReadFewFrame.java` source file

```java
import java.io.*;
import org.bytedeco.javacpp.*;
Expand Down
4 changes: 2 additions & 2 deletions ffmpeg/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ MFX_VERSION=1.35.1
NVCODEC_VERSION=11.1.5.0
XML2=libxml2-2.9.12
LIBSRT_VERSION=1.4.4
FFMPEG_VERSION=4.4.1
FFMPEG_VERSION=5.0
download https://download.videolan.org/contrib/nasm/nasm-$NASM_VERSION.tar.gz nasm-$NASM_VERSION.tar.gz
download http://zlib.net/$ZLIB.tar.gz $ZLIB.tar.gz
download http://downloads.sourceforge.net/project/lame/lame/3.100/$LAME.tar.gz $LAME.tar.gz
Expand Down Expand Up @@ -99,7 +99,7 @@ cd ..

patch -Np1 -d $LAME < ../../lame.patch
patch -Np1 -d $OPENSSL < ../../openssl-android.patch
patch -Np1 -d ffmpeg-$FFMPEG_VERSION < ../../ffmpeg.patch
patch -Np2 -d ffmpeg-$FFMPEG_VERSION < ../../ffmpeg.patch
sedinplace 's/bool bEnableavx512/bool bEnableavx512 = false/g' x265-*/source/common/param.h
sedinplace 's/detect512()/false/g' x265-*/source/common/quant.cpp

Expand Down
28 changes: 14 additions & 14 deletions ffmpeg/ffmpeg.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
--- ffmpeg-4.4/configure 2021-04-09 07:28:39.000000000 +1000
+++ linux-x86_64/ffmpeg-4.4/configure 2021-04-15 09:28:01.901102055 +1000
@@ -6364,7 +6364,7 @@
--- linux-x86_64/ffmpeg-5.0.orig/configure 2022-01-15 14:49:15.022054379 +1100
+++ linux-x86_64/ffmpeg-5.0/configure 2022-01-15 14:52:15.648669638 +1100
@@ -6532,7 +6532,7 @@
enabled libflite && require libflite "flite/flite.h" flite_init $flite_extralibs
enabled fontconfig && enable libfontconfig
enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
-enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
+enabled libfreetype && add_cppflags -I ../include/freetype2/ && require libfreetype "ft2build.h FT_FREETYPE_H" FT_Init_FreeType -lfreetype
enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
enabled libglslang && require_cpp libglslang glslang/SPIRV/GlslangToSpv.h "glslang::TIntermediate*" -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++
enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
@@ -6382,8 +6382,7 @@
enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
-lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
@@ -6555,8 +6555,7 @@
# Media SDK or Intel Media Server Studio, these don't come with
# pkg-config support. Instead, users should make sure that the build
# can find the libraries and headers through other means.
Expand All @@ -19,7 +19,7 @@
if enabled libmfx; then
check_cc MFX_CODEC_VP9 "mfx/mfxvp9.h mfx/mfxstructures.h" "MFX_CODEC_VP9"
fi
@@ -6401,19 +6400,12 @@
@@ -6574,19 +6573,12 @@
{ check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
Expand All @@ -38,10 +38,10 @@
- }
-}
+enabled libopus && add_cppflags -I ../include/opus/ && require libopus opus_multistream.h opus_multistream_decoder_create -lopus
enabled libplacebo && require_pkg_config libplacebo "libplacebo >= 4.192.0" libplacebo/vulkan.h pl_vulkan_create
enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection
enabled librav1e && require_pkg_config librav1e "rav1e >= 0.4.0" rav1e.h rav1e_context_new
@@ -6427,8 +6419,8 @@
@@ -6602,8 +6594,8 @@
enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
Expand All @@ -52,7 +52,7 @@
enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.8.4" EbSvtAv1Enc.h svt_av1_enc_init_handle
enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow
enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
@@ -6447,19 +6439,15 @@
@@ -6622,19 +6614,15 @@

enabled libvpx && {
enabled libvpx_vp8_decoder && {
Expand All @@ -72,7 +72,7 @@
check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs"
}
if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
@@ -6470,12 +6458,12 @@
@@ -6645,12 +6633,12 @@
enabled libwebp && {
enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
Expand All @@ -87,7 +87,7 @@
require_cpp_condition libx265 x265.h "X265_BUILD >= 70"
enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.3.0" "stdint.h xavs2.h" xavs2_api_get
@@ -6485,7 +6473,7 @@
@@ -6660,7 +6648,7 @@
enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new &&
{ test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" ||
enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; }
Expand All @@ -96,8 +96,8 @@
enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt.h mbedtls_x509_crt_init ||
check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init ||
check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto ||
@@ -6526,9 +6514,9 @@
enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
@@ -6704,9 +6692,9 @@
check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
check_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto ||
- check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
Expand Down
2 changes: 1 addition & 1 deletion ffmpeg/platform/gpl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg-platform-gpl</artifactId>
<version>4.4.1-${project.parent.version}</version>
<version>5.0-${project.parent.version}</version>
<name>JavaCPP Presets Platform for FFmpeg (GPL enabled)</name>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion ffmpeg/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg-platform</artifactId>
<version>4.4.1-${project.parent.version}</version>
<version>5.0-${project.parent.version}</version>
<name>JavaCPP Presets Platform for FFmpeg</name>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion ffmpeg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg</artifactId>
<version>4.4.1-${project.parent.version}</version>
<version>5.0-${project.parent.version}</version>
<name>JavaCPP Presets for FFmpeg</name>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions ffmpeg/samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg-platform</artifactId>
<version>4.4.1-1.5.7-SNAPSHOT</version>
<version>5.0-1.5.7-SNAPSHOT</version>
</dependency>

<!-- Optional GPL builds with (almost) everything enabled -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg-platform-gpl</artifactId>
<version>4.4.1-1.5.7-SNAPSHOT</version>
<version>5.0-1.5.7-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
Expand Down
6 changes: 3 additions & 3 deletions ffmpeg/src/main/java/org/bytedeco/ffmpeg/presets/avcodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
target = "org.bytedeco.ffmpeg.avcodec",
global = "org.bytedeco.ffmpeg.global.avcodec",
value = {
@Platform(cinclude = {"<libavcodec/codec_id.h>", "<libavcodec/codec_desc.h>", "<libavcodec/codec_par.h>", "<libavcodec/packet.h>",
@Platform(cinclude = {"<libavcodec/codec_id.h>", "<libavcodec/codec_desc.h>", "<libavcodec/codec_par.h>", "<libavcodec/packet.h>", "<libavcodec/defs.h>",
"<libavcodec/bsf.h>", "<libavcodec/codec.h>", "<libavcodec/avcodec.h>", "<libavcodec/jni.h>", "<libavcodec/avfft.h>"},
link = "avcodec@.58"),
link = "avcodec@.59"),
@Platform(value = "linux-arm", preload = {"asound@.2", "vchiq_arm", "vcos", "vcsm", "bcm_host", "mmal_core", "mmal_util", "mmal_vc_client"}),
@Platform(value = "windows", preload = "avcodec-58")
@Platform(value = "windows", preload = "avcodec-59")
}
)
public class avcodec implements InfoMapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
target = "org.bytedeco.ffmpeg.avdevice",
global = "org.bytedeco.ffmpeg.global.avdevice",
value = {
@Platform(cinclude = "<libavdevice/avdevice.h>", link = "avdevice@.58"),
@Platform(value = "windows", preload = "avdevice-58")
@Platform(cinclude = "<libavdevice/avdevice.h>", link = "avdevice@.59"),
@Platform(value = "windows", preload = "avdevice-59")
}
)
public class avdevice implements InfoMapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
target = "org.bytedeco.ffmpeg.avfilter",
global = "org.bytedeco.ffmpeg.global.avfilter",
value = {
@Platform(cinclude = {"<libavfilter/avfilter.h>", "<libavfilter/buffersink.h>", "<libavfilter/buffersrc.h>"}, link = "avfilter@.7"),
@Platform(value = "windows", preload = "avfilter-7")
@Platform(cinclude = {"<libavfilter/avfilter.h>", "<libavfilter/buffersink.h>", "<libavfilter/buffersrc.h>"}, link = "avfilter@.8"),
@Platform(value = "windows", preload = "avfilter-8")
}
)
public class avfilter implements InfoMapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
target = "org.bytedeco.ffmpeg.avformat",
global = "org.bytedeco.ffmpeg.global.avformat",
value = {
@Platform(cinclude = {"<libavformat/avio.h>", "<libavformat/avformat.h>"}, link = "avformat@.58"),
@Platform(value = "windows", preload = "avformat-58")
@Platform(cinclude = {"<libavformat/avio.h>", "<libavformat/avformat.h>"}, link = "avformat@.59"),
@Platform(value = "windows", preload = "avformat-59")
}
)
public class avformat implements InfoMapper {
Expand Down
4 changes: 2 additions & 2 deletions ffmpeg/src/main/java/org/bytedeco/ffmpeg/presets/avutil.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
"<libavutil/spherical.h>", "<libavutil/threadmessage.h>", "<libavutil/timecode.h>", "<libavutil/timestamp.h>", "<libavutil/tree.h>",
"<libavutil/tx.h>", "log_callback.h"},
includepath = {"/usr/local/include/ffmpeg/", "/opt/local/include/ffmpeg/", "/usr/include/ffmpeg/"},
link = "avutil@.56", compiler = {"default", "nodeprecated"}),
link = "avutil@.57", compiler = {"default", "nodeprecated"}),
@Platform(value = "linux-x86", preload = {"va@.1", "drm@.2", "va-drm@.1"}, preloadpath = {"/usr/lib32/", "/usr/lib/"}),
@Platform(value = "linux-x86_64", preloadpath = {"/usr/lib64/", "/usr/lib/"}),
@Platform(value = "windows", includepath = {"C:/MinGW/local/include/ffmpeg/", "C:/MinGW/include/ffmpeg/"}, preload = "avutil-56"),
@Platform(value = "windows", includepath = {"C:/MinGW/local/include/ffmpeg/", "C:/MinGW/include/ffmpeg/"}, preload = "avutil-57"),
@Platform(extension = "-gpl")
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
global = "org.bytedeco.ffmpeg.global.postproc",
value = {
// GPL only
@Platform(cinclude = "<libpostproc/postprocess.h>", link = "postproc@.55", extension = "-gpl"),
@Platform(value = "windows", preload = "postproc-55", extension = "-gpl")
@Platform(cinclude = "<libpostproc/postprocess.h>", link = "postproc@.56", extension = "-gpl"),
@Platform(value = "windows", preload = "postproc-56", extension = "-gpl")
}
)
public class postproc implements InfoMapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
target = "org.bytedeco.ffmpeg.swresample",
global = "org.bytedeco.ffmpeg.global.swresample",
value = {
@Platform(cinclude = "<libswresample/swresample.h>", link = "swresample@.3"),
@Platform(value = "windows", preload = "swresample-3")
@Platform(cinclude = "<libswresample/swresample.h>", link = "swresample@.4"),
@Platform(value = "windows", preload = "swresample-4")
}
)
public class swresample implements InfoMapper {
Expand Down
4 changes: 2 additions & 2 deletions ffmpeg/src/main/java/org/bytedeco/ffmpeg/presets/swscale.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
target = "org.bytedeco.ffmpeg.swscale",
global = "org.bytedeco.ffmpeg.global.swscale",
value = {
@Platform(cinclude = "<libswscale/swscale.h>", link = "swscale@.5"),
@Platform(value = "windows", preload = "swscale-5")
@Platform(cinclude = "<libswscale/swscale.h>", link = "swscale@.6"),
@Platform(value = "windows", preload = "swscale-6")
}
)
public class swscale implements InfoMapper {
Expand Down
2 changes: 1 addition & 1 deletion platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg-platform</artifactId>
<version>4.4.1-${project.version}</version>
<version>5.0-${project.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
Expand Down

0 comments on commit fa27b96

Please sign in to comment.