Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump all the project/plugin deps to their latest versions. #317

Merged
merged 5 commits into from
Mar 12, 2024
Merged
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
92 changes: 45 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FFmpeg Java
===========
# FFmpeg CLI Wrapper for Java

by Andrew Brampton ([bramp.net](https://bramp.net)) (c) 2013-2014,2016
by Andrew Brampton ([bramp.net](https://bramp.net)) (c) 2013-2024

Euklios marked this conversation as resolved.
Show resolved Hide resolved
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/bramp)

A fluent interface to running FFmpeg from Java.
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)
Expand All @@ -15,8 +14,7 @@ A fluent interface to running FFmpeg from Java.

[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.

Expand All @@ -28,12 +26,12 @@ We currently support Java 8 and above. Use Maven to install the dependency.
</dependency>
```

Usage
-----
## Usage

### Video Encoding

Code:

```java
FFmpeg ffmpeg = new FFmpeg("/path/to/ffmpeg");
FFprobe ffprobe = new FFprobe("/path/to/ffprobe");
Expand Down Expand Up @@ -73,64 +71,67 @@ 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
.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 @@ -148,8 +149,7 @@ git checkout ffmpeg-0.x
mvn clean javadoc:aggregate scm-publish:publish-scm
```

Bumpings Deps
-----
## Bumpings Deps

```bash
# Update Maven Plugins
Expand All @@ -159,26 +159,24 @@ mvn versions:display-plugin-updates
mvn versions:display-dependency-updates
```

Install FFmpeg on Ubuntu
-----------------
## 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 involved!
-------------
## 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-2022, 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
Loading