Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
8 changes: 4 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
strategy:
matrix:
# Long term supported versions
java-version: [8, 11, 17, 21]
java-version: [11, 17, 21]

# TODO Should we test locales? The old travis setup did, see:
# https://github.com/bramp/ffmpeg-cli-wrapper/pull/55

name: JDK ${{ matrix.java-version }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: Set up FFmpeg
uses: FedericoCarboni/setup-ffmpeg@v3
Expand All @@ -35,7 +35,7 @@ jobs:
ffmpeg-version: release

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

name: Java CI with Maven

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest
# Enable debugging to help resolve:
# https://github.com/federicocarboni/setup-ffmpeg/issues/19
environment: debug
strategy:
matrix:
# Long term supported versions
java-version: [11, 17, 21]

# TODO Should we test locales? The old travis setup did, see:
# https://github.com/bramp/ffmpeg-cli-wrapper/pull/55

name: JDK ${{ matrix.java-version }}

steps:
- uses: actions/checkout@v6

- name: Set up FFmpeg
uses: FedericoCarboni/setup-ffmpeg@v3
id: setup-ffmpeg
with:
ffmpeg-version: release

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v5
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
cache: maven

- name: Compile with Maven
run: mvn --batch-mode --update-snapshots compile

- name: Test with Maven, Package and Verify with Maven
run: mvn --batch-mode --update-snapshots verify -Dgpg.skip

# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@v5
continue-on-error: true
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
args: [--allow-multiple-documents]
- id: end-of-file-fixer
exclude: ^src/test/resources/
- id: trailing-whitespace
exclude: ^src/test/resources/
- repo: local
hooks:
- id: maven-format
name: Maven Format
entry: mvn fmt:format
language: system
types: [java]
pass_filenames: false

- id: maven-test
name: Maven Test
entry: mvn test
language: system
types: [java]
pass_filenames: false
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ by Andrew Brampton ([bramp.net](https://bramp.net)) (c) 2013-2024

A fluent interface for running FFmpeg from Java.

![Java](https://img.shields.io/badge/Java-8+-brightgreen.svg)
[![Build Status](https://github.com/bramp/ffmpeg-cli-wrapper/actions/workflows/maven.yml/badge.svg)](https://github.com/bramp/ffmpeg-cli-wrapper/actions/workflows/maven.yml)
![Java](https://img.shields.io/badge/Java-11+-brightgreen.svg)
[![Build Status](https://github.com/bramp/ffmpeg-cli-wrapper/actions/workflows/test.yml/badge.svg)](https://github.com/bramp/ffmpeg-cli-wrapper/actions/workflows/test.yml)
[![Coverage Status](https://img.shields.io/coveralls/bramp/ffmpeg-cli-wrapper.svg)](https://coveralls.io/github/bramp/ffmpeg-cli-wrapper)
[![Maven](https://img.shields.io/maven-central/v/net.bramp.ffmpeg/ffmpeg.svg)](http://mvnrepository.com/artifact/net.bramp.ffmpeg/ffmpeg)
[![Libraries.io](https://img.shields.io/librariesio/github/bramp/ffmpeg-cli-wrapper.svg)](https://libraries.io/github/bramp/ffmpeg-cli-wrapper)
Expand All @@ -16,7 +16,7 @@ A fluent interface for running FFmpeg from Java.

## Install

We currently support Java 8 and above. Use Maven to install the dependency.
We currently support Java 11 and above. Use Maven to install the dependency.

```xml
<dependency>
Expand Down Expand Up @@ -78,7 +78,7 @@ FFprobe ffprobe = new FFprobe("/path/to/ffprobe");
FFmpegProbeResult probeResult = ffprobe.probe("input.mp4");

FFmpegFormat format = probeResult.getFormat();
System.out.format("%nFile: '%s' ; Format: '%s' ; Duration: %.3fs",
System.out.format("%nFile: '%s' ; Format: '%s' ; Duration: %.3fs",
format.filename,
format.format_long_name,
format.duration
Expand Down Expand Up @@ -158,7 +158,7 @@ mvn clean javadoc:aggregate scm-publish:publish-scm
mvn versions:display-plugin-updates

# Library Dependencies
mvn versions:display-dependency-updates
mvn versions:display-dependency-updates
```

## Install FFmpeg on Ubuntu
Expand Down
39 changes: 20 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<connection>scm:git:git@github.com:bramp/ffmpeg-cli-wrapper.git</connection>
<tag>ffmpeg-0.7.0</tag>
</scm>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/bramp/ffmpeg-cli-wrapper/issues</url>
Expand All @@ -39,7 +39,7 @@
</developers>

<properties>
<base.java.version>8</base.java.version>
<base.java.version>11</base.java.version>
<maven.compiler.source>${base.java.version}</maven.compiler.source>
<maven.compiler.target>${base.java.version}</maven.compiler.target>

Expand All @@ -52,49 +52,49 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.13</version>
<version>2.0.17</version>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.8.6</version>
<version>4.9.8</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>2.25.0</version>
<version>2.48.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.2.1-jre</version>
<version>33.5.0-jre</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.16.1</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.16.0</version>
<version>3.20.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.11.0</version>
<version>2.13.2</version>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
<version>3.2.1</version>
<version>3.2.6</version>
</dependency>

<!-- Test Scope -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.5.6</version>
<version>1.5.32</version>
</dependency>

<dependency>
Expand All @@ -105,7 +105,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.12.0</version>
<version>5.23.0</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
Expand All @@ -125,7 +125,7 @@
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http-server</artifactId>
<version>4.0.2</version>
<version>5.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down Expand Up @@ -256,7 +256,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<version>3.15.0</version>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
Expand Down Expand Up @@ -286,7 +286,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
<version>3.1.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -306,7 +306,7 @@
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.23</version>
<version>2.29</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -523,7 +523,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.5.0</version>
<version>3.9.0</version>
</plugin>

<plugin>
Expand All @@ -535,7 +535,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>taglist-maven-plugin</artifactId>
<version>3.0.0</version>
<version>3.2.2</version>
<configuration>
<aggregate>true</aggregate>
<tagListOptions>
Expand Down Expand Up @@ -748,12 +748,13 @@
<!-- Various flags needed for com.google.errorprone-->
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne</arg>
<arg>--should-stop=ifError=FLOW</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.29.2</version>
<version>2.48.0</version>
</path>
<!-- Other annotation processors go here.

Expand Down
9 changes: 4 additions & 5 deletions src/main/java/net/bramp/ffmpeg/FFcommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.io.CharStreams;
import net.bramp.ffmpeg.io.ProcessUtils;
import net.bramp.ffmpeg.probe.FFmpegError;
import net.bramp.ffmpeg.probe.FFmpegProbeResult;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
Expand All @@ -19,6 +15,9 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.annotation.Nonnull;
import net.bramp.ffmpeg.io.ProcessUtils;
import net.bramp.ffmpeg.probe.FFmpegError;
import net.bramp.ffmpeg.probe.FFmpegProbeResult;

/** Private class to contain common methods for both FFmpeg and FFprobe. */
abstract class FFcommon {
Expand Down Expand Up @@ -87,7 +86,7 @@ protected void throwOnError(Process p, FFmpegProbeResult result) throws IOExcept
// TODO Parse the error
final FFmpegError ffmpegError = null == result ? null : result.getError();
throw new FFmpegException(
path + " returned non-zero exit status. Check stdout.", ffmpegError);
path + " returned non-zero exit status. Check stdout.", ffmpegError);
}
} catch (TimeoutException e) {
throw new IOException("Timed out waiting for " + path + " to finish.");
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/net/bramp/ffmpeg/FFmpeg.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ public class FFmpeg extends FFcommon {
static final Pattern FORMATS_REGEX = Pattern.compile("^ ([ D][ E]) (\\S+)\\s+(.*)$");
static final Pattern PIXEL_FORMATS_REGEX =
Pattern.compile("^([.I][.O][.H][.P][.B]) (\\S{2,})\\s+(\\d+)\\s+(\\d+)$");
static final Pattern FILTERS_REGEX = Pattern.compile("^\\s*(?<timelinesupport>[T.])(?<slicethreading>[S.])(?<commandsupport>[C.])\\s(?<name>[A-Za-z0-9_]+)\\s+(?<inputpattern>[AVN|]+)->(?<outputpattern>[AVN|]+)\\s+(?<description>.*)$");
static final Pattern FILTERS_REGEX =
Pattern.compile(
"^\\s*(?<timelinesupport>[T.])(?<slicethreading>[S.])(?<commandsupport>[C.])\\s(?<name>[A-Za-z0-9_]+)\\s+(?<inputpattern>[AVN|]+)->(?<outputpattern>[AVN|]+)\\s+(?<description>.*)$");

/** Supported codecs */
List<Codec> codecs = null;
Expand Down Expand Up @@ -169,15 +171,15 @@ private void checkIfFFmpeg() throws IllegalArgumentException, IOException {

// (?<inputpattern>[AVN|]+)->(?<outputpattern>[AVN|]+)\s+(?<description>.*)$

filters.add(new Filter(
filters.add(
new Filter(
m.group("timelinesupport").equals("T"),
m.group("slicethreading").equals("S"),
m.group("commandsupport").equals("C"),
m.group("name"),
new FilterPattern(m.group("inputpattern")),
new FilterPattern(m.group("outputpattern")),
m.group("description")
));
m.group("description")));
}

throwOnError(p);
Expand Down Expand Up @@ -258,7 +260,6 @@ public synchronized List<ChannelLayout> channelLayouts() throws IOException {
} finally {
p.destroy();
}

}

return this.channelLayouts;
Expand Down
Loading
Loading