├── settings.gradle
├── misc
└── logo.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── src
├── main
│ └── java
│ │ └── com
│ │ └── github
│ │ └── vbauer
│ │ └── avconv4java
│ │ ├── type
│ │ ├── NamedType.java
│ │ ├── AVFormatDebugInfoType.java
│ │ ├── AVVideoCodecType.java
│ │ ├── AVStreamType.java
│ │ ├── AVHardwareAccelerationType.java
│ │ ├── AVTargetFileType.java
│ │ ├── AVErrorDetectionType.java
│ │ ├── AVAudioCodecType.java
│ │ ├── AVLogLevelType.java
│ │ ├── AVVideoSyncType.java
│ │ ├── AVStrictType.java
│ │ ├── AVFormatFlagType.java
│ │ ├── AVFileFormatType.java
│ │ ├── AVMotionEstimationType.java
│ │ ├── AVMovFlagsType.java
│ │ ├── AVDebugInfoType.java
│ │ ├── AVVideoSizeType.java
│ │ └── AVCodecFlagType.java
│ │ ├── util
│ │ ├── process
│ │ │ ├── ProcessInfo.java
│ │ │ └── ProcessExecutor.java
│ │ └── AVUtils.java
│ │ ├── option
│ │ ├── AVSubtitleOptions.java
│ │ ├── AVGenericOptions.java
│ │ ├── advanced
│ │ │ ├── AVAdvancedVideoOptions.java
│ │ │ └── AVAdvancedOptions.java
│ │ ├── AVAudioOptions.java
│ │ ├── AVFormatOptions.java
│ │ ├── AVCodecOptions.java
│ │ ├── AVVideoOptions.java
│ │ └── AVMainOptions.java
│ │ └── core
│ │ ├── AVRootOptions.java
│ │ ├── AVOptions.java
│ │ └── AVCommand.java
└── test
│ ├── kotlin
│ └── com
│ │ └── github
│ │ └── vbauer
│ │ └── avconv4java
│ │ ├── common
│ │ └── TestUtils.kt
│ │ ├── option
│ │ ├── AVSubtitleOptionsTest.kt
│ │ ├── AVGenericOptionsTest.kt
│ │ ├── advanced
│ │ │ ├── AVAdvancedOptionsTest.kt
│ │ │ └── AVAdvancedVideoOptionsTest.kt
│ │ ├── AVAudioOptionsTest.kt
│ │ ├── AVFormatOptionsTest.kt
│ │ ├── AVCodecOptionsTest.kt
│ │ ├── AVMainOptionsTest.kt
│ │ └── AVVideoOptionsTest.kt
│ │ ├── core
│ │ ├── AVRootOptionsTest.kt
│ │ ├── AVCommandTest.kt
│ │ └── AVOptionsTest.kt
│ │ ├── type
│ │ ├── TypeTest.kt
│ │ └── ModelTest.kt
│ │ └── util
│ │ ├── ProcessExecutorTest.kt
│ │ └── AVUtilsTest.kt
│ └── resources
│ └── TODO.txt
├── .travis.yml
├── deploy.sh
├── .gitignore
├── gradlew.bat
├── README.md
└── gradlew
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'avconv4java'
2 |
--------------------------------------------------------------------------------
/misc/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vbauer/avconv4java/HEAD/misc/logo.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vbauer/avconv4java/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/src/main/java/com/github/vbauer/avconv4java/type/NamedType.java:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.type;
2 |
3 | /**
4 | * @author Vladislav Bauer
5 | */
6 |
7 | public interface NamedType {
8 |
9 | String getName();
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/src/test/kotlin/com/github/vbauer/avconv4java/common/TestUtils.kt:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.common
2 |
3 | import com.pushtorefresh.private_constructor_checker.PrivateConstructorChecker
4 |
5 | /**
6 | * @author Vladislav Bauer
7 | */
8 |
9 | class TestUtils private constructor() {
10 |
11 | companion object {
12 | fun checkUtilClassConstructor(utilsClass: Class<*>) {
13 | PrivateConstructorChecker.forClass(utilsClass)
14 | .expectedTypeOfException(UnsupportedOperationException::class.java)
15 | .check()
16 | }
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | jdk:
3 | - oraclejdk8
4 | - openjdk11
5 |
6 | sudo: false
7 |
8 | before_install:
9 | - chmod +x gradlew deploy.sh
10 |
11 | script:
12 | - ./gradlew build --stacktrace
13 |
14 | after_success:
15 | - ./gradlew jacocoTestReport coveralls --stacktrace
16 | - bash ./deploy.sh
17 |
18 | before_cache:
19 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
20 | cache:
21 | directories:
22 | - $HOME/.gradle/caches/
23 | - $HOME/.gradle/wrapper/
24 |
25 | env:
26 | global:
27 | - TERM=dumb
28 | - GH_REF: github.com/vbauer/avconv4java.git
29 | - secure: "Rki2d/a/sy4/C6/o5hWNX/HOFOFs6vn4IDnrs8viQoGwmbD6czmhbCVAuSchOXns1N69lNU1O3IDSksKk5Omwai0nSyOewsAlq7PoNB12TgEu5MbJOazqZnFqaPLEcyTc6Kkju1b3Qje5XNo5pspxN5ZknXD/fMsZPcFQ5+EwgY="
30 |
--------------------------------------------------------------------------------
/src/test/kotlin/com/github/vbauer/avconv4java/option/AVSubtitleOptionsTest.kt:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.option
2 |
3 | import org.hamcrest.MatcherAssert.assertThat
4 | import org.hamcrest.Matchers.emptyIterable
5 | import org.hamcrest.Matchers.not
6 | import org.testng.annotations.Test
7 | import org.testng.collections.Lists
8 |
9 | /**
10 | * @author Vladislav Bauer
11 | */
12 |
13 | class AVSubtitleOptionsTest {
14 |
15 | @Test
16 | fun testSmokeAVSubtitleOptions() {
17 | val options = AVSubtitleOptions.create()
18 | .disableRecording()
19 | .subtitleCodec("codecName")
20 | .builders(Lists.newArrayList())
21 | .builders()
22 | .flags(Lists.newArrayList())
23 | .flags()
24 | .build()
25 |
26 | assertThat(options, not(emptyIterable()))
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/test/kotlin/com/github/vbauer/avconv4java/core/AVRootOptionsTest.kt:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.core
2 |
3 | import org.hamcrest.MatcherAssert.assertThat
4 | import org.hamcrest.Matchers.*
5 | import org.testng.annotations.Test
6 | import org.testng.collections.Lists
7 |
8 | /**
9 | * @author Vladislav Bauer
10 | */
11 |
12 | class AVRootOptionsTest {
13 |
14 | @Test
15 | fun testSmokeAVRootOptions() {
16 | val rootOptions = AVRootOptions.create(INPUT_FILE, OUTPUT_FILE)
17 | .builders(Lists.newArrayList())
18 | .builders()
19 | .flags(Lists.newArrayList())
20 | .flags()
21 |
22 | assertThat(rootOptions.outputFile, equalTo(OUTPUT_FILE))
23 |
24 | val options = rootOptions.build()
25 | assertThat(options, not(emptyIterable()))
26 | }
27 |
28 | companion object {
29 | private const val INPUT_FILE = "inputFile"
30 | private const val OUTPUT_FILE = "outputFile"
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/github/vbauer/avconv4java/type/AVFormatDebugInfoType.java:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.type;
2 |
3 | import com.github.vbauer.avconv4java.util.AVUtils;
4 |
5 | /**
6 | * @author Vladislav Bauer
7 | */
8 |
9 | public enum AVFormatDebugInfoType implements NamedType {
10 |
11 | TS(Constants.TS);
12 |
13 |
14 | private final String name;
15 |
16 |
17 | AVFormatDebugInfoType(final String name) {
18 | this.name = name;
19 | }
20 |
21 |
22 | @Override
23 | public String getName() {
24 | return name;
25 | }
26 |
27 |
28 | public static AVFormatDebugInfoType findByName(final String name) {
29 | return AVUtils.findByName(AVFormatDebugInfoType.class, name);
30 | }
31 |
32 |
33 | /**
34 | * @author Vladislav Bauer
35 | */
36 |
37 | public static final class Constants {
38 |
39 | public static final String TS = "ts";
40 |
41 |
42 | private Constants() {
43 | throw new UnsupportedOperationException();
44 | }
45 |
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/test/kotlin/com/github/vbauer/avconv4java/option/AVGenericOptionsTest.kt:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.option
2 |
3 | import com.github.vbauer.avconv4java.type.AVLogLevelType
4 | import org.hamcrest.MatcherAssert.assertThat
5 | import org.hamcrest.Matchers.emptyIterable
6 | import org.hamcrest.Matchers.not
7 | import org.testng.annotations.Test
8 | import org.testng.collections.Lists
9 |
10 | /**
11 | * @author Vladislav Bauer
12 | */
13 |
14 | class AVGenericOptionsTest {
15 |
16 | @Test
17 | fun testSmokeAVGenericOptions() {
18 | val options = AVGenericOptions.create()
19 | .cpuFlags("mask")
20 | .logLevel(1)
21 | .logLevel(AVLogLevelType.DEBUG)
22 | .logLevel(AVLogLevelType.DEBUG.getName())
23 | .showLicense()
24 | .builders(Lists.newArrayList())
25 | .builders()
26 | .flags(Lists.newArrayList())
27 | .flags()
28 | .build()
29 |
30 | assertThat(options, not(emptyIterable()))
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Exit with nonzero exit code if anything fails
4 | set -e
5 |
6 | # Lets work only for master
7 | if ! [ "$TRAVIS_BRANCH" = "master" ]
8 | then
9 | echo "Not a master, not deploying"
10 | exit 0
11 | fi
12 |
13 | # Generate Javadoc
14 | ./gradlew javadoc
15 |
16 | # Go to the generated directory and create a *new* Git repo
17 | cd build/docs/javadoc
18 | git init
19 |
20 | # Inside this git repo we'll pretend to be a new user
21 | git config user.name "Vladislav Bauer"
22 | git config user.email "bauer.vlad@gmail.com"
23 |
24 | # The first and only commit to this new Git repo contains all the
25 | # files present with the commit message "Generate Maven Site"
26 | git add .
27 | git commit -m "Generate Maven Site"
28 |
29 | # Force push from the current repo's master branch to the remote
30 | # repo's gh-pages branch. (All previous history on the gh-pages branch
31 | # will be lost, since we are overwriting it.) We redirect any output to
32 | # /dev/null to hide any sensitive credential data that might otherwise be exposed
33 | git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1
34 |
--------------------------------------------------------------------------------
/src/main/java/com/github/vbauer/avconv4java/type/AVVideoCodecType.java:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.type;
2 |
3 | import com.github.vbauer.avconv4java.util.AVUtils;
4 |
5 | /**
6 | * @author Vladislav Bauer
7 | */
8 |
9 | public enum AVVideoCodecType implements NamedType {
10 |
11 | H264(Constants.H264),
12 |
13 | THEORA(Constants.THEORA);
14 |
15 |
16 | private final String name;
17 |
18 |
19 | AVVideoCodecType(final String name) {
20 | this.name = name;
21 | }
22 |
23 |
24 | @Override
25 | public String getName() {
26 | return name;
27 | }
28 |
29 |
30 | public static AVVideoCodecType findByName(final String name) {
31 | return AVUtils.findByName(AVVideoCodecType.class, name);
32 | }
33 |
34 |
35 | /**
36 | * @author Vladislav Bauer
37 | */
38 |
39 | public static final class Constants {
40 |
41 | public static final String H264 = "libx264";
42 | public static final String THEORA = "libtheora";
43 |
44 |
45 | private Constants() {
46 | throw new UnsupportedOperationException();
47 | }
48 |
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/github/vbauer/avconv4java/type/AVStreamType.java:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.type;
2 |
3 | import com.github.vbauer.avconv4java.util.AVUtils;
4 |
5 | /**
6 | * @author Vladislav Bauer
7 | */
8 |
9 | public enum AVStreamType implements NamedType {
10 |
11 | AUDIO(Constants.AUDIO),
12 |
13 | VIDEO(Constants.VIDEO),
14 |
15 | SUBTITLE(Constants.SUBTITLE);
16 |
17 |
18 | private final String name;
19 |
20 |
21 | AVStreamType(final String name) {
22 | this.name = name;
23 | }
24 |
25 |
26 | @Override
27 | public String getName() {
28 | return name;
29 | }
30 |
31 |
32 | public static AVStreamType findByName(final String name) {
33 | return AVUtils.findByName(AVStreamType.class, name);
34 | }
35 |
36 |
37 | /**
38 | * @author Vladislav Bauer
39 | */
40 |
41 | public static final class Constants {
42 |
43 | public static final String AUDIO = "a";
44 | public static final String VIDEO = "v";
45 | public static final String SUBTITLE = "s";
46 |
47 |
48 | private Constants() {
49 | throw new UnsupportedOperationException();
50 | }
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/test/kotlin/com/github/vbauer/avconv4java/option/advanced/AVAdvancedOptionsTest.kt:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.option.advanced
2 |
3 | import com.github.vbauer.avconv4java.type.AVVideoSyncType
4 | import org.hamcrest.MatcherAssert.assertThat
5 | import org.hamcrest.Matchers.emptyIterable
6 | import org.hamcrest.Matchers.not
7 | import org.testng.annotations.Test
8 | import org.testng.collections.Lists
9 |
10 | /**
11 | * @author Vladislav Bauer
12 | */
13 |
14 | class AVAdvancedOptionsTest {
15 |
16 | @Test
17 | fun testSmokeAVAdvancedOptions() {
18 | val options = AVAdvancedOptions.create()
19 | .accurateSeek(true)
20 | .benchmark()
21 | .copyTimeBase()
22 | .copyTimestamps()
23 | .demuxPreLoadDelay(1L)
24 | .discontinuityDeltaThreshold()
25 | .dump()
26 | .filterComplexScript("fileName")
27 | .hex()
28 | .maxDemuxDelay(1L)
29 | .shortest()
30 | .timeLimit(1L)
31 | .videoSyncMethod(AVVideoSyncType.AUTO)
32 | .videoSyncMethod(AVVideoSyncType.AUTO.getName())
33 | .builders(Lists.newArrayList())
34 | .builders()
35 | .flags(Lists.newArrayList())
36 | .flags()
37 | .build()
38 |
39 | assertThat(options, not(emptyIterable()))
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/test/kotlin/com/github/vbauer/avconv4java/option/advanced/AVAdvancedVideoOptionsTest.kt:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.option.advanced
2 |
3 | import com.github.vbauer.avconv4java.type.AVHardwareAccelerationType
4 | import com.github.vbauer.avconv4java.type.AVStreamType
5 | import org.hamcrest.MatcherAssert.assertThat
6 | import org.hamcrest.Matchers.emptyIterable
7 | import org.hamcrest.Matchers.not
8 | import org.testng.annotations.Test
9 | import org.testng.collections.Lists
10 |
11 | /**
12 | * @author Vladislav Bauer
13 | */
14 |
15 | class AVAdvancedVideoOptionsTest {
16 |
17 | @Test
18 | fun testSmokeAVAdvancedVideoOptions() {
19 | val options = AVAdvancedVideoOptions.create()
20 | .discardThreshold(1)
21 | .dumpVideoEncodingStatistics()
22 | .dumpVideoEncodingStatistics("fileName")
23 | .hardwareAcceleration(AVStreamType.AUDIO, AVHardwareAccelerationType.AUTO)
24 | .hardwareAcceleration(AVStreamType.AUDIO, AVHardwareAccelerationType.AUTO.getName())
25 | .pixelFormat(AVStreamType.AUDIO, "format")
26 | .pixelFormat("format")
27 | .swScalerFlags("flags")
28 | .builders(Lists.newArrayList())
29 | .builders()
30 | .flags(Lists.newArrayList())
31 | .flags()
32 | .build()
33 |
34 | assertThat(options, not(emptyIterable()))
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/kotlin/com/github/vbauer/avconv4java/option/AVAudioOptionsTest.kt:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.option
2 |
3 | import com.github.vbauer.avconv4java.type.AVAudioCodecType
4 | import com.github.vbauer.avconv4java.type.AVStreamType
5 | import org.hamcrest.MatcherAssert.assertThat
6 | import org.hamcrest.Matchers.emptyIterable
7 | import org.hamcrest.Matchers.not
8 | import org.testng.annotations.Test
9 | import org.testng.collections.Lists
10 |
11 | /**
12 | * @author Vladislav Bauer
13 | */
14 |
15 | class AVAudioOptionsTest {
16 |
17 | @Test
18 | fun testSmokeAVAudioOptions() {
19 | val options = AVAudioOptions.create()
20 | .audioBitRate(1)
21 | .audioChannelsCount(AVStreamType.AUDIO, 1)
22 | .audioChannelsCount(1)
23 | .audioCodec(AVAudioCodecType.AAC)
24 | .audioCodec(AVAudioCodecType.AAC.getName())
25 | .audioQuality(1.0)
26 | .disableRecording()
27 | .filter("filter")
28 | .flags("flag")
29 | .framesCount(1L)
30 | .sampleFormat(AVStreamType.AUDIO, "format")
31 | .sampleFormat("format")
32 | .sampleRate(AVStreamType.AUDIO, 1)
33 | .sampleRate(1)
34 | .builders(Lists.newArrayList())
35 | .builders()
36 | .flags(Lists.newArrayList())
37 | .flags()
38 | .build()
39 |
40 | assertThat(options, not(emptyIterable()))
41 | }
42 |
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/github/vbauer/avconv4java/type/AVHardwareAccelerationType.java:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.type;
2 |
3 | import com.github.vbauer.avconv4java.util.AVUtils;
4 |
5 | /**
6 | * @author Vladislav Bauer
7 | */
8 |
9 | public enum AVHardwareAccelerationType implements NamedType {
10 |
11 | /**
12 | * Do not use any hardware acceleration (the default).
13 | */
14 | NONE(Constants.NONE),
15 |
16 | /**
17 | * Automatically select the hardware acceleration method.
18 | */
19 | AUTO(Constants.AUTO),
20 |
21 | /**
22 | * Use VDPAU (Video Decode and Presentation API for Unix) hardware acceleration.
23 | */
24 | VDPAU(Constants.VDPAU);
25 |
26 |
27 | private final String name;
28 |
29 |
30 | AVHardwareAccelerationType(final String name) {
31 | this.name = name;
32 | }
33 |
34 |
35 | @Override
36 | public String getName() {
37 | return name;
38 | }
39 |
40 |
41 | public static AVHardwareAccelerationType findByName(final String name) {
42 | return AVUtils.findByName(AVHardwareAccelerationType.class, name);
43 | }
44 |
45 |
46 | /**
47 | * @author Vladislav Bauer
48 | */
49 |
50 | public static final class Constants {
51 |
52 | public static final String NONE = "none";
53 | public static final String AUTO = "auto";
54 | public static final String VDPAU = "vdpau";
55 |
56 |
57 | private Constants() {
58 | throw new UnsupportedOperationException();
59 | }
60 |
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/src/main/java/com/github/vbauer/avconv4java/type/AVTargetFileType.java:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.type;
2 |
3 | import com.github.vbauer.avconv4java.util.AVUtils;
4 |
5 | /**
6 | * @author Vladislav Bauer
7 | */
8 |
9 | public enum AVTargetFileType implements NamedType {
10 |
11 | VCD(Constants.VCD),
12 |
13 | SVCD(Constants.SVCD),
14 |
15 | DVD(Constants.DVD),
16 |
17 | DV(Constants.DV),
18 |
19 | DV50(Constants.DV50);
20 |
21 |
22 | private final String name;
23 |
24 |
25 | AVTargetFileType(final String name) {
26 | this.name = name;
27 | }
28 |
29 |
30 | @Override
31 | public String getName() {
32 | return name;
33 | }
34 |
35 |
36 | public static AVTargetFileType findByName(final String name) {
37 | return AVUtils.findByName(AVTargetFileType.class, name);
38 | }
39 |
40 |
41 | /**
42 | * @author Vladislav Bauer
43 | */
44 |
45 | public static final class Constants {
46 |
47 | public static final String VCD = "vcd";
48 | public static final String SVCD = "svcd";
49 | public static final String DVD = "dvd";
50 | public static final String DV = "dv";
51 | public static final String DV50 = "dv50";
52 |
53 | public static final String PREFIX_PAL = "pal-";
54 | public static final String PREFIX_NTSC = "ntsc-";
55 | public static final String PREFIX_FILM = "film-";
56 |
57 |
58 | private Constants() {
59 | throw new UnsupportedOperationException();
60 | }
61 |
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/test/kotlin/com/github/vbauer/avconv4java/core/AVCommandTest.kt:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.core
2 |
3 | import org.hamcrest.MatcherAssert.assertThat
4 | import org.hamcrest.Matchers.*
5 | import org.testng.Assert.fail
6 | import org.testng.annotations.Test
7 |
8 | /**
9 | * @author Vladislav Bauer
10 | */
11 |
12 | class AVCommandTest {
13 |
14 | @Test
15 | fun testGlobalMethods() {
16 | assertThat(AVCommand.getDefaultToolPath(), notNullValue())
17 | assertThat(AVCommand.setGlobalToolPath(null), nullValue())
18 | assertThat(AVCommand.getGlobalToolPath(), nullValue())
19 | }
20 |
21 | @Test
22 | fun testGettersAndSetters() {
23 | val command = createCommand()
24 |
25 | assertThat(command.isDebug, equalTo(false))
26 | assertThat(command.timeout, equalTo(1L))
27 | assertThat(command.toolPath, nullValue())
28 | }
29 |
30 | @Test
31 | fun testCalculateToolPath() {
32 | val command = createCommand()
33 |
34 | AVCommand.setGlobalToolPath(null)
35 | assertThat(command.calculateToolPath(), nullValue())
36 | }
37 |
38 | @Test(expectedExceptions = [NullPointerException::class])
39 | fun test() {
40 | AVCommand.setGlobalToolPath(null)
41 |
42 | val command = createCommand()
43 | fail(command.run(AVOptions.create()).toString())
44 | }
45 |
46 |
47 | /*
48 | * Internal API.
49 | */
50 |
51 | private fun createCommand(): AVCommand {
52 | return AVCommand()
53 | .setDebug(false)
54 | .setTimeout(1L)
55 | .setToolPath(null)
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/com/github/vbauer/avconv4java/type/AVErrorDetectionType.java:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.type;
2 |
3 | import com.github.vbauer.avconv4java.util.AVUtils;
4 |
5 | /**
6 | * @author Vladislav Bauer
7 | */
8 |
9 | public enum AVErrorDetectionType implements NamedType {
10 |
11 | /**
12 | * Verify embedded CRCs.
13 | */
14 | CRC_CHECK(Constants.CRC_CHECK),
15 |
16 | /**
17 | * Detect bitstream specification deviations.
18 | */
19 | BIT_STREAM(Constants.BIT_STREAM),
20 |
21 | /**
22 | * Detect improper bitstream length.
23 | */
24 | BUFFER(Constants.BUFFER),
25 |
26 | /**
27 | * Abort decoding on minor error detection.
28 | */
29 | EXPLODE(Constants.EXPLODE);
30 |
31 |
32 | private final String name;
33 |
34 |
35 | AVErrorDetectionType(final String name) {
36 | this.name = name;
37 | }
38 |
39 |
40 | @Override
41 | public String getName() {
42 | return name;
43 | }
44 |
45 |
46 | public static AVErrorDetectionType findByName(final String name) {
47 | return AVUtils.findByName(AVErrorDetectionType.class, name);
48 | }
49 |
50 |
51 | /**
52 | * @author Vladislav Bauer
53 | */
54 |
55 | public static final class Constants {
56 |
57 | public static final String CRC_CHECK = "crccheck";
58 | public static final String BIT_STREAM = "bitstream";
59 | public static final String BUFFER = "buffer";
60 | public static final String EXPLODE = "explode";
61 |
62 |
63 | private Constants() {
64 | throw new UnsupportedOperationException();
65 | }
66 |
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/com/github/vbauer/avconv4java/type/AVAudioCodecType.java:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.type;
2 |
3 | import com.github.vbauer.avconv4java.util.AVUtils;
4 |
5 | /**
6 | * @author Vladislav Bauer
7 | */
8 |
9 | public enum AVAudioCodecType implements NamedType {
10 |
11 | VORBIS(Constants.VORBIS),
12 |
13 | /**
14 | * May be used only with -strict experimental.
15 | * Not so stable yet and overall quality is very bad, but bundled with avconv
16 | */
17 | AAC(Constants.AAC),
18 |
19 | /**
20 | * The best aac encoder so far, but separate lib.
21 | */
22 | FDK_AAC(Constants.FDK_AAC),
23 |
24 | /**
25 | * Not bad encoder, bundled with daily windows builds.
26 | */
27 | VISUAL_ON_AAC(Constants.VISUAL_ON_ACC);
28 |
29 |
30 | private final String name;
31 |
32 |
33 | AVAudioCodecType(final String name) {
34 | this.name = name;
35 | }
36 |
37 |
38 | @Override
39 | public String getName() {
40 | return name;
41 | }
42 |
43 |
44 | public static AVAudioCodecType findByName(final String name) {
45 | return AVUtils.findByName(AVAudioCodecType.class, name);
46 | }
47 |
48 |
49 | /**
50 | * @author Vladislav Bauer
51 | */
52 |
53 | public static final class Constants {
54 |
55 | public static final String VORBIS = "libvorbis";
56 | public static final String AAC = "aac";
57 | public static final String FDK_AAC = "libfdk_aac";
58 | public static final String VISUAL_ON_ACC = "libvo_aacenc";
59 |
60 |
61 | private Constants() {
62 | throw new UnsupportedOperationException();
63 | }
64 |
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/com/github/vbauer/avconv4java/type/AVLogLevelType.java:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.type;
2 |
3 | import com.github.vbauer.avconv4java.util.AVUtils;
4 |
5 | /**
6 | * @author Vladislav Bauer
7 | */
8 |
9 | public enum AVLogLevelType implements NamedType {
10 |
11 | QUIET(Constants.QUIET),
12 |
13 | PANIC(Constants.PANIC),
14 |
15 | FATAL(Constants.FATAL),
16 |
17 | ERROR(Constants.ERROR),
18 |
19 | WARNING(Constants.WARNING),
20 |
21 | INFO(Constants.INFO),
22 |
23 | VERBOSE(Constants.VERBOSE),
24 |
25 | DEBUG(Constants.DEBUG);
26 |
27 |
28 | private final String name;
29 |
30 |
31 | AVLogLevelType(final String name) {
32 | this.name = name;
33 | }
34 |
35 |
36 | @Override
37 | public String getName() {
38 | return name;
39 | }
40 |
41 |
42 | public static AVLogLevelType findByName(final String name) {
43 | return AVUtils.findByName(AVLogLevelType.class, name);
44 | }
45 |
46 |
47 | /**
48 | * @author Vladislav Bauer
49 | */
50 |
51 | public static final class Constants {
52 |
53 | public static final String QUIET = "quiet";
54 | public static final String PANIC = "panic";
55 | public static final String FATAL = "fatal";
56 | public static final String ERROR = "error";
57 | public static final String WARNING = "warning";
58 | public static final String INFO = "info";
59 | public static final String VERBOSE = "verbose";
60 | public static final String DEBUG = "debug";
61 |
62 |
63 | private Constants() {
64 | throw new UnsupportedOperationException();
65 | }
66 |
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/test/kotlin/com/github/vbauer/avconv4java/option/AVFormatOptionsTest.kt:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.option
2 |
3 | import com.github.vbauer.avconv4java.type.AVErrorDetectionType
4 | import com.github.vbauer.avconv4java.type.AVFormatDebugInfoType
5 | import com.github.vbauer.avconv4java.type.AVFormatFlagType
6 | import org.hamcrest.MatcherAssert.assertThat
7 | import org.hamcrest.Matchers.emptyIterable
8 | import org.hamcrest.Matchers.not
9 | import org.testng.annotations.Test
10 | import org.testng.collections.Lists
11 |
12 | /**
13 | * @author Vladislav Bauer
14 | */
15 |
16 | class AVFormatOptionsTest {
17 |
18 | @Test
19 | fun testSmokeAVFormatOptions() {
20 | val options = AVFormatOptions.create()
21 | .analyzeDuration(1L)
22 | .debugInfo(AVFormatDebugInfoType.TS)
23 | .debugInfo(AVFormatDebugInfoType.TS.getName())
24 | .decryptionKey("key")
25 | .errorDetection(AVErrorDetectionType.BIT_STREAM)
26 | .errorDetection(AVErrorDetectionType.BIT_STREAM.getName())
27 | .formatFlags(AVFormatFlagType.DISCARD_CORRUPTED)
28 | .formatFlags(AVFormatFlagType.DISCARD_CORRUPTED.getName())
29 | .fpsProbeSize(1L)
30 | .interleavingBufferSize(1L)
31 | .maxDelay(1L)
32 | .packetSize(1L)
33 | .probeSize(1L)
34 | .realTimeBufferSize(1L)
35 | .timestampIndexSize(1L)
36 | .builders(Lists.newArrayList())
37 | .builders()
38 | .flags(Lists.newArrayList())
39 | .flags()
40 | .build()
41 |
42 | assertThat(options, not(emptyIterable()))
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/github/vbauer/avconv4java/type/AVVideoSyncType.java:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.type;
2 |
3 | import com.github.vbauer.avconv4java.util.AVUtils;
4 |
5 | /**
6 | * @author Vladislav Bauer
7 | */
8 |
9 | public enum AVVideoSyncType implements NamedType {
10 |
11 | /**
12 | * Each frame is passed with its timestamp from the demuxer to the muxer.
13 | */
14 | PASS_THROUGH(Constants.PASS_THROUGH),
15 |
16 | /**
17 | * Frames will be duplicated and dropped to achieve exactly the requested constant framerate.
18 | */
19 | CRF(Constants.CFR),
20 |
21 | /**
22 | * Frames are passed through with their timestamp or dropped so as to prevent 2 frames from having same timestamp.
23 | */
24 | VFR(Constants.VFR),
25 |
26 | /**
27 | * Chooses between 1 and 2 depending on muxer capabilities. This is the default method.
28 | */
29 | AUTO(Constants.AUTO);
30 |
31 |
32 | private final String name;
33 |
34 |
35 | AVVideoSyncType(final String name) {
36 | this.name = name;
37 | }
38 |
39 |
40 | @Override
41 | public String getName() {
42 | return name;
43 | }
44 |
45 |
46 | public static AVVideoSyncType findByName(final String name) {
47 | return AVUtils.findByName(AVVideoSyncType.class, name);
48 | }
49 |
50 |
51 | /**
52 | * @author Vladislav Bauer
53 | */
54 |
55 | public static final class Constants {
56 |
57 | public static final String PASS_THROUGH = "passthrough";
58 | public static final String CFR = "cfr";
59 | public static final String VFR = "vfr";
60 | public static final String AUTO = "auto";
61 |
62 |
63 | private Constants() {
64 | throw new UnsupportedOperationException();
65 | }
66 |
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/com/github/vbauer/avconv4java/util/process/ProcessInfo.java:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.util.process;
2 |
3 | import com.github.vbauer.avconv4java.util.AVUtils;
4 |
5 | /**
6 | * Process info that was returned as result.
7 | *
8 | * @author Vladislav Bauer
9 | */
10 |
11 | public class ProcessInfo {
12 |
13 | public static final int EXIT_CODE_ERROR = 1;
14 | public static final int EXIT_CODE_SUCCESS = 0;
15 |
16 |
17 | private int statusCode;
18 | private String output;
19 | private String errorOutput;
20 |
21 |
22 | public static ProcessInfo error(final String errorOutput) {
23 | return create(EXIT_CODE_ERROR, null, errorOutput);
24 | }
25 |
26 | public static ProcessInfo create(final int statusCode, final String output, final String errorOutput) {
27 | return new ProcessInfo()
28 | .setStatusCode(statusCode)
29 | .setOutput(output)
30 | .setErrorOutput(errorOutput);
31 | }
32 |
33 |
34 | public int getStatusCode() {
35 | return statusCode;
36 | }
37 |
38 | public ProcessInfo setStatusCode(final int statusCode) {
39 | this.statusCode = statusCode;
40 | return this;
41 | }
42 |
43 | public String getOutput() {
44 | return output;
45 | }
46 |
47 | public ProcessInfo setOutput(final String output) {
48 | this.output = output;
49 | return this;
50 | }
51 |
52 | public String getErrorOutput() {
53 | return errorOutput;
54 | }
55 |
56 | public ProcessInfo setErrorOutput(final String errorOutput) {
57 | this.errorOutput = errorOutput;
58 | return this;
59 | }
60 |
61 | public boolean isSuccess() {
62 | return getStatusCode() == EXIT_CODE_SUCCESS && AVUtils.isBlank(getErrorOutput());
63 | }
64 |
65 | public boolean isError() {
66 | return !isSuccess();
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/com/github/vbauer/avconv4java/option/AVSubtitleOptions.java:
--------------------------------------------------------------------------------
1 | package com.github.vbauer.avconv4java.option;
2 |
3 | import com.github.vbauer.avconv4java.core.AVOptions;
4 |
5 | import java.util.Collection;
6 |
7 | /**
8 | * Subtitle options.
9 | * @see Official doc: "5.11 Subtitle options"
10 | *
11 | * @author Vladislav Bauer
12 | */
13 |
14 | public class AVSubtitleOptions extends AVOptions {
15 |
16 | public static final String FLAG_SUBTITLE_CODEC = "-scodec";
17 | public static final String FLAG_DISABLE_SUBTITLE_RECORDING = "-sn";
18 |
19 |
20 | public static AVSubtitleOptions create() {
21 | return new AVSubtitleOptions();
22 | }
23 |
24 |
25 | @Override
26 | public AVSubtitleOptions flags(final Collection