Skip to content

Commit

Permalink
Merge pull request #210 from kokorin/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
kokorin authored Aug 16, 2021
2 parents 3f6409f + cb840e7 commit 8a5cbde
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 158 deletions.
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Issue
about: Create an issue to help us improve
title: ''

---

**Describe the issue**
A clear and concise description of what the issue is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Sample file**
If applicable, attach a file with which the issue can be reproduced

**Expected behavior**
A clear and concise description of what you expected to happen.

**Logs**
If applicable, add logs to help explain your problem.

**Additional context**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/workflows/sonar-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
run: |
if [ -n "$SONAR_TOKEN" ]
then
bash mvnw -B jacoco:prepare-agent verify jacoco:report sonar:sonar -DFFMPEG_BIN=/usr/bin
bash mvnw -B jacoco:prepare-agent verify jacoco:report sonar:sonar
else
echo "Skipping sonar if a PR is created from a fork"
echo "Secrets are not available in such PRs for security reason"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ jobs:
if: startsWith(matrix.os, 'windows')

- name: Build on Ubuntu
run: bash mvnw clean package -B -DFFMPEG_BIN=/usr/bin
run: bash mvnw clean package -B
if: startsWith(matrix.os, 'ubuntu')

- name: Build on MacOS
run: bash mvnw clean package -B -DFFMPEG_BIN=/usr/local/opt/ffmpeg/bin
run: bash mvnw clean package -B
if: startsWith(matrix.os, 'macos')

- name: Build on Windows
run: ./mvnw clean package -B "-DFFMPEG_BIN=C:\ProgramData\chocolatey\lib\ffmpeg\tools\ffmpeg\bin"
run: ./mvnw clean package -B
if: startsWith(matrix.os, 'windows')

test-release:
Expand Down
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Contribution Guidelines

If you want to raise a Pull Request, please follow these guidelines:

* Fork the repo
* Create your feature branch based on the `develop` branch
* Raise a PR that targets the `kokorin:develop` branch
* Include appropriate Unit Tests
* Consider using `com.github.kokorin.jaffree.Artifacts` for sample files used in the tests.

12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,14 +539,4 @@ mvn clean install -PJ9-module
Some code in the unit tests relies on having ffmpeg / ffprobe available on your `PATH`.
Other parts of the unit test code requires that you have configured `FFMPEG_BIN` as either an environment variable or as a Java system property.

You will need to ensure that both are set up correctly in order to run the unit tests successfully.

# Contribution Guidelines

If you want to raise a Pull Request, please follow these guidelines:

* Fork the repo
* Create your feature branch based on the `develop` branch
* Raise a PR that targets the `kokorin:develop` branch
* Include appropriate Unit Tests
Consider using `com.github.kokorin.jaffree.Artifacts` for sample files used in the tests.
You will need to ensure that both are set up correctly in order to run the unit tests successfully.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.45</version>
<version>8.45.1</version>
</dependency>
</dependencies>
<executions>
Expand Down
29 changes: 29 additions & 0 deletions src/test/java/com/github/kokorin/jaffree/Config.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.github.kokorin.jaffree;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.file.Path;
import java.nio.file.Paths;

public class Config {
private static final Logger LOGGER = LoggerFactory.getLogger(Config.class);
public static final Path FFMPEG_BIN = getFfmpegBin();

private static Path getFfmpegBin() {
String ffmpegHome = System.getProperty("FFMPEG_BIN");
if (ffmpegHome != null) {
LOGGER.info("Using FFMPEG_BIN from system property: {}", ffmpegHome);
return Paths.get(ffmpegHome);
}

ffmpegHome = System.getenv("FFMPEG_BIN");
if (ffmpegHome != null) {
LOGGER.info("Using FFMPEG_BIN from environment variable: {}", ffmpegHome);
return Paths.get(ffmpegHome);
}

LOGGER.warn("FFMPEG_BIN not configured: expecting to find ffmpeg on PATH");
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.kokorin.jaffree.ffmpeg;

import com.github.kokorin.jaffree.Artifacts;
import com.github.kokorin.jaffree.Config;
import com.github.kokorin.jaffree.ffprobe.FFprobe;
import com.github.kokorin.jaffree.ffprobe.FFprobeResult;
import com.github.kokorin.jaffree.ffprobe.Stream;
Expand All @@ -15,21 +16,6 @@

public class FFmpegFilterTest {

public static Path BIN;


@BeforeClass
public static void setUp() throws Exception {
String ffmpegHome = System.getProperty("FFMPEG_BIN");
if (ffmpegHome == null) {
ffmpegHome = System.getenv("FFMPEG_BIN");
}
Assert.assertNotNull(
"Nor command line property, neither system variable FFMPEG_BIN is set up",
ffmpegHome);
BIN = Paths.get(ffmpegHome);
}

/**
* Test, that creates mosaic video from 4 sources
* <p>
Expand All @@ -42,7 +28,7 @@ public void testMosaic() throws Exception {
Path tempDir = Files.createTempDirectory("jaffree");
Path outputPath = tempDir.resolve("mosaic.mkv");

FFmpegResult result = FFmpeg.atPath(BIN)
FFmpegResult result = FFmpeg.atPath(Config.FFMPEG_BIN)
.addInput(UrlInput.fromPath(Artifacts.VIDEO_MP4).setDuration(10, TimeUnit.SECONDS))
.addInput(UrlInput.fromPath(Artifacts.SMALL_FLV).setDuration(10, TimeUnit.SECONDS))
.addInput(UrlInput.fromPath(Artifacts.SMALL_MP4).setDuration(10, TimeUnit.SECONDS))
Expand Down Expand Up @@ -124,7 +110,7 @@ public void testMosaic() throws Exception {

Assert.assertNotNull(result);

FFprobeResult probe = FFprobe.atPath(BIN)
FFprobeResult probe = FFprobe.atPath(Config.FFMPEG_BIN)
.setInput(outputPath)
.setShowStreams(true)
.execute();
Expand Down Expand Up @@ -159,7 +145,7 @@ public void testConcatWithReencode() throws Exception {
Path tempDir = Files.createTempDirectory("jaffree");
Path outputPath = tempDir.resolve("concat.mp4");

FFmpegResult result = FFmpeg.atPath(BIN)
FFmpegResult result = FFmpeg.atPath(Config.FFMPEG_BIN)
.addInput(UrlInput.fromPath(Artifacts.VIDEO_MP4).setDuration(5, TimeUnit.SECONDS))
.addInput(
UrlInput.fromPath(Artifacts.VIDEO_MKV).setPositionEof(-5, TimeUnit.SECONDS))
Expand Down Expand Up @@ -190,7 +176,7 @@ public void testConcatWithReencode() throws Exception {

Assert.assertNotNull(result);

FFprobeResult probe = FFprobe.atPath(BIN)
FFprobeResult probe = FFprobe.atPath(Config.FFMPEG_BIN)
.setInput(outputPath)
.setShowStreams(true)
.execute();
Expand Down
Loading

0 comments on commit 8a5cbde

Please sign in to comment.