Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
76afbfd
Propagate FFmpegError through FFmpegException on FFprobe failures
Dec 10, 2020
08f59b6
Fix typo in Strict enum (#230)
Mar 30, 2021
dc8c39c
Add an example test (that I added a really long time ago, and never c…
bramp Apr 10, 2022
c13c490
Bump min java version to 1.8 and updated all the maven plugins.
bramp Apr 10, 2022
fe13fda
Bumped the version of the all the dependencies.
bramp Apr 10, 2022
fa855f3
Fixed a unit test (due to change in behaviour with ModelMapper.
bramp Apr 10, 2022
df4da9a
Reformatted the code (per the latest standards) and fixed up a couple…
bramp Apr 10, 2022
9853c1a
Reverted two logging deps to stable versions (I accidently bumped the…
bramp Apr 10, 2022
577a8da
[maven-release-plugin] prepare release ffmpeg-0.7.0
bramp Apr 10, 2022
6af838d
[maven-release-plugin] prepare for next development iteration
bramp Apr 10, 2022
2b5cb9d
Update README to use 0.7.0.
bramp Apr 10, 2022
9a5507c
Fix #260: FFmpeg.codecs() returns empty list
Euklios Oct 9, 2022
2e19872
public the Enum Codec.Type
xmg333 Aug 5, 2022
220248b
Fix #209 -user-agent tag is not supported
Euklios Oct 9, 2022
ec5fabc
Fix #264: Add additional CodecTypes to FFmpegStream (#265)
Euklios Oct 9, 2022
3550064
Fix #262: Add method to load pixel formats (#263)
Euklios Oct 9, 2022
2b1f65c
Mock runFunc and add assertions to FFmpegGetInfoTest
Euklios Oct 9, 2022
4bfc88b
Fix #266: Add option to specify subtitle codec (#267)
Euklios Oct 9, 2022
59c5a56
Add video side_data_list property (#278)
ukjjang Jan 16, 2023
fb26c21
Fix readme to remove a obsolete method (#283)
orthlus Mar 15, 2023
abcbacf
Bumped a bunch of plugin deps to get the project to build again.
bramp Oct 26, 2023
a218f33
Reformatted some code per the latest fmt plugin.
bramp Oct 26, 2023
6e04b5f
Fix #191: Ignore out_time_us field (#289)
sverkera Oct 26, 2023
6f95619
[maven-release-plugin] prepare release ffmpeg-0.8.0
bramp Oct 26, 2023
1231b95
[maven-release-plugin] prepare for next development iteration
bramp Oct 26, 2023
e68f9b3
Minor tweaks to the README.
bramp Oct 26, 2023
b8e588a
Added method for using two pass with progress to class FFmpegExecutor…
EasyG0ing1 Oct 26, 2023
205e253
add vbr encoding option (#177)
Oct 26, 2023
e47b3e9
Allow extra arguments to FFprobe (#254)
luca992 Oct 26, 2023
c01fc75
Bump ch.qos.logback:logback-classic from 1.4.11 to 1.4.12
dependabot[bot] Nov 29, 2023
78a9274
Fix missing .done() on Builder
blakehawkins Dec 22, 2023
4577297
Add thread option (#303)
Euklios Feb 20, 2024
ee8e399
Feature/test probe video2 failing (#307)
Euklios Mar 8, 2024
0184306
chore: Extract and merge CodecType (#306)
Euklios Mar 10, 2024
314e3fd
chore: Add ffmpeg version to bug_report.md (#308)
Euklios Mar 10, 2024
bb52097
Change FFmpegChapter#id type to long (#310)
Euklios Mar 10, 2024
045cb82
Implement filters info (#309)
Euklios Mar 10, 2024
2ada172
Add a buy me a coffee link to the README.md
bramp Mar 10, 2024
ad968e4
Changed maven compile to be more strict with lint issues, and fixed a…
bramp Mar 10, 2024
1fa60d6
Added new Java/Maven build/test github action workflow.
bramp Mar 10, 2024
f3249e8
Removed old travis configs.
bramp Mar 10, 2024
3ae1f5e
Remove old code climate setup.
bramp Mar 10, 2024
b5a564c
Updated Github Action to use latest maven-dependency-submission and a…
bramp Mar 11, 2024
0e8d173
Add additional N/A checks to FFmpegUtils
Euklios Mar 11, 2024
6966a23
Test N/A values in all Progress parser implementations
Euklios Mar 11, 2024
4bc84da
Replace animal-sniffer with javac parameter (#312)
Euklios Mar 11, 2024
8890104
Feature/pr214 Appendable to output and error streams - changes (#304)
Euklios Mar 11, 2024
053c32c
Created JDK 8 and 9 maven profiles, and allow JDK 8 to use old versio…
bramp Mar 11, 2024
be9d457
Add JDK 8 to the Github actions for testing.
bramp Mar 11, 2024
1d11c37
Feature/ffmpeg layouts (#314)
Euklios Mar 11, 2024
e196dc5
Add labels to issue templates
Euklios Mar 11, 2024
0616541
Create FUNDING.yml
bramp Mar 11, 2024
f315cfc
Bump all the project/plugin deps to their latest versions. (#317)
bramp Mar 12, 2024
1374982
Issue/138 build ffprobe command (#268)
Euklios Mar 13, 2024
faedc82
Add getters to FFmpegOutputBuilder and deprecate property access (#320)
Euklios Mar 20, 2024
4569a57
Enable debug logging on github action
bramp Mar 20, 2024
7d17f11
Add support for parsing all the codec flags
bramp Mar 20, 2024
6ecaef8
Add enum for video and audio codecs. (#321)
van1164 Apr 4, 2024
a1f78a1
feature/update-logback (#335)
Euklios Aug 8, 2024
a6e8213
Add FFmpegHlsOutputBuilder for HLS user (#322)
van1164 Aug 8, 2024
fa72c36
fix(hls): Move setFormat into the OutputBuilder (#337)
Euklios Aug 8, 2024
2ce21da
fix: Don't check if the ffprobe executable path matches while testing…
Euklios Aug 8, 2024
221637f
Feature/bump dependencies (#340)
Euklios Aug 9, 2024
4518bfc
test: Add additional tests to ffprobe (#341)
Euklios Aug 9, 2024
46c41e3
Fix/disposition not deserializing default field (#342)
Euklios Aug 9, 2024
69b2912
Merge remote-tracking branch 'barnettj/master'
Euklios Aug 9, 2024
813640f
Feature/update big bock bunny fixture (#343)
Euklios Aug 9, 2024
9289e50
Feature/process utils jdk 8 (#344)
Euklios Aug 10, 2024
c932b78
Bug/347 invalid chars in hls time (#348)
Euklios Aug 21, 2024
b3b21a9
Revert "Bug/347 invalid chars in hls time (#348)" (#349)
Euklios Aug 21, 2024
4506377
Feature/318 input builder (#339)
Euklios Aug 21, 2024
bfb63a3
Feature/345 add strict option on builder (#352)
Euklios Aug 21, 2024
25acdc4
Feature/346 add bf option (#351)
Euklios Aug 21, 2024
ead7e04
test: Add specific examples for input builder (#353)
Euklios Aug 22, 2024
a665513
fix(ffprobe-number-format-exception): fix gson parse SideData.rotatio…
ChenYangY Feb 12, 2025
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
6 changes: 0 additions & 6 deletions .codeclimate.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: bramp
buy_me_a_coffee: bramp
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Bug report
about: Create a report to help us improve
labels: bug

---

Expand All @@ -18,6 +19,7 @@ A clear and concise description of what you expected to happen.
**Version (if applicable):**
- OS: [e.g. Linux]
- Java Version [e.g. 8]
- FFmpeg version [e.g. 6.1.1]

**Additional context**
Add any other context about the problem here.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Feature request
about: Suggest an idea for this project
labels: enhancement

---

Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Question
about: Have a question on how to use ffmpeg-cli-wrapper
labels: question

---

Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/maven.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: [8, 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

- 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@v3
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@v4
continue-on-error: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ apidocs
*.log
*.log.mbtree
output.mp4
tmp/
48 changes: 0 additions & 48 deletions .travis.yml

This file was deleted.

116 changes: 66 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,45 @@
FFmpeg Java
===========
by Andrew Brampton ([bramp.net](https://bramp.net)) (c) 2013-2014,2016
# FFmpeg CLI Wrapper for Java

A fluent interface to running FFmpeg from Java.
by Andrew Brampton ([bramp.net](https://bramp.net)) (c) 2013-2024

![Java](https://img.shields.io/badge/Java-7+-brightgreen.svg)
[![Build Status](https://img.shields.io/travis/bramp/ffmpeg-cli-wrapper/master.svg)](https://travis-ci.org/bramp/ffmpeg-cli-wrapper)
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/bramp)

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)
[![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)

[GitHub](https://github.com/bramp/ffmpeg-cli-wrapper) | [API docs](https://bramp.github.io/ffmpeg-cli-wrapper/)

Install
-------
## Install

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

Maven:
```xml
<dependency>
<groupId>net.bramp.ffmpeg</groupId>
<artifactId>ffmpeg</artifactId>
<version>0.6.2</version>
<version>0.8.0</version>
</dependency>
```

Usage
-----
## Usage

### Video Encoding

Code:

```java
FFmpeg ffmpeg = new FFmpeg("/path/to/ffmpeg");
FFprobe ffprobe = new FFprobe("/path/to/ffprobe");

FFmpegBuilder builder = new FFmpegBuilder()

.setInput("input.mp4") // Filename, or a FFmpegProbeResult
.done()
.overrideOutputFiles(true) // Override the output if it exists

.addOutput("output.mp4") // Filename for the destination
Expand All @@ -55,7 +58,7 @@ FFmpegBuilder builder = new FFmpegBuilder()
.setVideoResolution(640, 480) // at 640x480 resolution

.setStrict(FFmpegBuilder.Strict.EXPERIMENTAL) // Allow FFmpeg to use experimental specs
.done();
.done();

FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);

Expand All @@ -69,64 +72,68 @@ executor.createTwoPassJob(builder).run();
### Get Media Information

Code:

```java
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",
format.filename,
format.format_long_name,
format.duration
format.filename,
format.format_long_name,
format.duration
);

FFmpegStream stream = probeResult.getStreams().get(0);
System.out.format("%nCodec: '%s' ; Width: %dpx ; Height: %dpx",
stream.codec_long_name,
stream.width,
stream.height
stream.codec_long_name,
stream.width,
stream.height
);
```

### Get progress while encoding

```java
FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);

FFmpegProbeResult in = ffprobe.probe("input.flv");

FFmpegBuilder builder = new FFmpegBuilder()
.setInput(in) // Or filename
.addOutput("output.mp4")
.done();
.setInput(in) // Or filename
.done()
.addOutput("output.mp4")
.done();

FFmpegJob job = executor.createJob(builder, new ProgressListener() {

// Using the FFmpegProbeResult determine the duration of the input
final double duration_ns = in.getFormat().duration * TimeUnit.SECONDS.toNanos(1);

@Override
public void progress(Progress progress) {
double percentage = progress.out_time_ns / duration_ns;

// Print out interesting information about the progress
System.out.println(String.format(
"[%.0f%%] status:%s frame:%d time:%s ms fps:%.0f speed:%.2fx",
percentage * 100,
progress.status,
progress.frame,
FFmpegUtils.toTimecode(progress.out_time_ns, TimeUnit.NANOSECONDS),
progress.fps.doubleValue(),
progress.speed
));
}
// Using the FFmpegProbeResult determine the duration of the input
final double duration_ns = in.getFormat().duration * TimeUnit.SECONDS.toNanos(1);

@Override
public void progress(Progress progress) {
double percentage = progress.out_time_ns / duration_ns;

// Print out interesting information about the progress
System.out.println(String.format(
"[%.0f%%] status:%s frame:%d time:%s ms fps:%.0f speed:%.2fx",
percentage * 100,
progress.status,
progress.frame,
FFmpegUtils.toTimecode(progress.out_time_ns, TimeUnit.NANOSECONDS),
progress.fps.doubleValue(),
progress.speed
));
}
});

job.run();
```

Building & Releasing
--------------
## Building & Releasing

If you wish to make changes, then building and releasing is simple:

```bash
# To build
mvn
Expand All @@ -135,6 +142,7 @@ mvn
mvn test

# To release (pushing jar to maven central)
# (don't forget to set up your ~/.m2/settings.xml)
mvn release:prepare
mvn release:perform

Expand All @@ -143,26 +151,34 @@ git checkout ffmpeg-0.x
mvn clean javadoc:aggregate scm-publish:publish-scm
```

Install FFmpeg on Ubuntu
-----------------
## Bumpings Deps

```bash
# Update Maven Plugins
mvn versions:display-plugin-updates

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

## Install FFmpeg on Ubuntu

We only the support the original FFmpeg, not the libav version. Before Ubuntu 12.04, and in 15.04
and later the original FFmpeg is shipped. If you have to run on a version with libav, you can install
FFmpeg from a PPA, or using the static build. More information [here](http://askubuntu.com/q/373322/34845)

Get invovled!
-------------
## Get involved

We welcome contributions. Please check the [issue tracker](https://github.com/bramp/ffmpeg-cli-wrapper/issues).
If you see something you wish to work on, please either comment on the issue, or just send a pull
request. Want to work on something else, then just open a issue, and we can discuss! We appreciate
documentation improvements, code cleanup, or new features. Please be mindful that all work is done
on a volunteer basis, thus we can be slow to reply.

Licence (Simplified BSD License)
--------------------------------
```
Copyright (c) 2016, Andrew Brampton
## Licence (Simplified BSD License)

```plaintext
Copyright (c) 2013-2024, Andrew Brampton
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
Loading