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 4ff9263
Show file tree
Hide file tree
Showing 58 changed files with 1,311 additions and 2,590 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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
import static org.bytedeco.ffmpeg.global.avcodec.*;


/**
* \addtogroup lavc_core
* \{
*/

/**
* The bitstream filter state.
*
Expand Down Expand Up @@ -53,12 +58,6 @@ public class AVBSFContext extends Pointer {
*/
public native @Const AVBitStreamFilter filter(); public native AVBSFContext filter(AVBitStreamFilter setter);

/**
* Opaque libavcodec internal data. Must not be touched by the caller in any
* way.
*/
public native AVBSFInternal internal(); public native AVBSFContext internal(AVBSFInternal setter);

/**
* Opaque filter-specific private data. If filter->priv_class is non-NULL,
* this is an AVOptions-enabled struct.
Expand Down
29 changes: 0 additions & 29 deletions ffmpeg/src/gen/java/org/bytedeco/ffmpeg/avcodec/AVBSFInternal.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,23 @@ public class AVCPBProperties extends Pointer {
* Maximum bitrate of the stream, in bits per second.
* Zero if unknown or unspecified.
*/
// #if FF_API_UNSANITIZED_BITRATES
public native int max_bitrate(); public native AVCPBProperties max_bitrate(int setter);
// #else
// #endif
public native @Cast("int64_t") long max_bitrate(); public native AVCPBProperties max_bitrate(long setter);
/**
* Minimum bitrate of the stream, in bits per second.
* Zero if unknown or unspecified.
*/
// #if FF_API_UNSANITIZED_BITRATES
public native int min_bitrate(); public native AVCPBProperties min_bitrate(int setter);
// #else
// #endif
public native @Cast("int64_t") long min_bitrate(); public native AVCPBProperties min_bitrate(long setter);
/**
* Average bitrate of the stream, in bits per second.
* Zero if unknown or unspecified.
*/
// #if FF_API_UNSANITIZED_BITRATES
public native int avg_bitrate(); public native AVCPBProperties avg_bitrate(int setter);
// #else
// #endif
public native @Cast("int64_t") long avg_bitrate(); public native AVCPBProperties avg_bitrate(long setter);

/**
* The size of the buffer to which the ratecontrol is applied, in bits.
* Zero if unknown or unspecified.
*/
public native int buffer_size(); public native AVCPBProperties buffer_size(int setter);
public native @Cast("int64_t") long buffer_size(); public native AVCPBProperties buffer_size(long setter);

/**
* The delay between the time the packet this structure is associated with
Expand Down
Loading

0 comments on commit 4ff9263

Please sign in to comment.