Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
1da375267a | |||
d7a4513de7 | |||
37f2bf0268 | |||
5f8df35171 | |||
2a007df722 | |||
73b15ce781 | |||
3e50146f5e | |||
5d36c40508 | |||
12f81cb014 | |||
8c0c52c736 | |||
bd8e36d893 | |||
dacd86039d | |||
af41be829a | |||
1c08196104 | |||
7b23fa248b | |||
095e5c2a84 | |||
0c77a7ab04 | |||
cfb1d09eb7 | |||
bd4117df38 | |||
0eaf18822b | |||
7bdd4a5dfb | |||
ea6e6c95e1 | |||
c7f9c4cf73 | |||
ce9efc463d | |||
879ff8f8f4 | |||
f132861cbc | |||
47e8ec4f43 | |||
c0c96c7a51 | |||
8cb640d804 | |||
1189f4b61c | |||
0f5b9eb45a | |||
9a567b7178 | |||
88f63e040e | |||
aabf1d49a7 | |||
3b789eb623 | |||
ad0115e5f2 |
@ -1,19 +1,19 @@
|
|||||||
pipeline:
|
pipeline:
|
||||||
test:
|
test:
|
||||||
image: maven:3-jdk-11
|
image: maven:3-eclipse-temurin-17-alpine
|
||||||
commands:
|
commands:
|
||||||
- apt update && apt install -y lsof
|
- apk add lsof
|
||||||
- mvn test
|
- mvn test
|
||||||
|
|
||||||
build:
|
build:
|
||||||
image: maven:3-jdk-11
|
image: maven:3-eclipse-temurin-17-alpine
|
||||||
commands:
|
commands:
|
||||||
- mvn clean compile assembly:single
|
- mvn clean compile assembly:single
|
||||||
|
|
||||||
package:
|
package:
|
||||||
image: maven:3-jdk-11
|
image: maven:3-eclipse-temurin-17-alpine
|
||||||
commands:
|
commands:
|
||||||
- apt update && apt install -y rpm
|
- apk add rpm
|
||||||
- mvn clean compile package -Dmaven.test.skip
|
- mvn clean compile package -Dmaven.test.skip
|
||||||
when:
|
when:
|
||||||
event: tag
|
event: tag
|
||||||
@ -31,3 +31,49 @@ pipeline:
|
|||||||
- target/rpm/dragoon/RPMS/noarch/dragoon-*.rpm
|
- target/rpm/dragoon/RPMS/noarch/dragoon-*.rpm
|
||||||
when:
|
when:
|
||||||
event: tag
|
event: tag
|
||||||
|
|
||||||
|
copy_deb_package:
|
||||||
|
image: appleboy/drone-scp
|
||||||
|
settings:
|
||||||
|
host: "repo.int.metaunix.net"
|
||||||
|
username:
|
||||||
|
from_secret: repo_admin
|
||||||
|
password:
|
||||||
|
from_secret: repo_password
|
||||||
|
port: 22
|
||||||
|
target: /srv/repo/apt/dragoon/
|
||||||
|
source: target/dragoon-*.deb
|
||||||
|
strip_components: 1
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
||||||
|
copy_rpm_package:
|
||||||
|
image: appleboy/drone-scp
|
||||||
|
settings:
|
||||||
|
host: "repo.int.metaunix.net"
|
||||||
|
username:
|
||||||
|
from_secret: repo_admin
|
||||||
|
password:
|
||||||
|
from_secret: repo_password
|
||||||
|
port: 22
|
||||||
|
target: /srv/repo/dnf/dragoon/
|
||||||
|
source: target/rpm/dragoon/RPMS/noarch/dragoon-*.rpm
|
||||||
|
strip_components: 5
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
||||||
|
update_repos:
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
- repo.int.metaunix.net
|
||||||
|
username:
|
||||||
|
from_secret: repo_admin
|
||||||
|
password:
|
||||||
|
from_secret: repo_password
|
||||||
|
port: 22
|
||||||
|
command_timeout: 2m
|
||||||
|
script:
|
||||||
|
- sudo /home/xadmin/scripts/update_repo.sh
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
75
README.md
75
README.md
@ -2,19 +2,69 @@
|
|||||||
|
|
||||||
The Bit Goblin video transcoder.
|
The Bit Goblin video transcoder.
|
||||||
|
|
||||||
|
## Installing from RPM
|
||||||
|
|
||||||
|
Installing from the Bit Goblin repository is easy! Add the following repo file to `/etc/yum.repos.d/bitgoblin.repo`:
|
||||||
|
|
||||||
|
```
|
||||||
|
[bitgoblin]
|
||||||
|
name=Bit Goblin repository
|
||||||
|
baseurl=http://repo.metaunix.net/dnf
|
||||||
|
enabled=1
|
||||||
|
gpgcheck=0
|
||||||
|
```
|
||||||
|
|
||||||
|
Update your package sources just to make sure all was added properly:
|
||||||
|
|
||||||
|
```
|
||||||
|
dnf updateinfo
|
||||||
|
```
|
||||||
|
|
||||||
|
Then install dragoon! Use the command below if you DON'T want DNF to install a bunch of unnecessary stuff to meet OpenJDK's weak dependencies; otherwise a regular `dnf install dragoon` is fine:
|
||||||
|
|
||||||
|
```
|
||||||
|
dnf --setopt=install_weak_deps=False --best install dragoon
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
If you were paying attention to Dragoon's output, you would have noticed that it failed with a complaint about not finding a configuration file. The location might move in the future or even be configurable, but for now you need to have a TOML file located at `~/.config/dragoon.toml` with at minimum the following contents:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
# This example transcodes footage to DNxHD 1080p60 for use in video editors like DaVinci Resolve.
|
||||||
|
[transcoder]
|
||||||
|
repo_path = '~/videos' # location of the videos to transcode
|
||||||
|
interval = 15 # number of minutes in between transcoding runs
|
||||||
|
video_format = 'mov' # video container format
|
||||||
|
video_codec = 'dnxhd' # video codec to use
|
||||||
|
video_parameters = 'scale=1920x1080,fps=60,format=yuv422p' # video extra format parameters flag - this will be broken later into separate attributes
|
||||||
|
video_profile = 'dnxhr_hq' # DNxHD has multiple presets for various video qualities
|
||||||
|
audio_codec = 'pcm_s16le' # audio codec to use
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also run `./dragoon.jar -i` to install a new configuration file with some "workable" defaults. You can pair this with the `-c /path/to/config.toml` flag to specify a location to put the config file.
|
||||||
|
|
||||||
|
## CLI Parameters
|
||||||
|
|
||||||
|
Dragoon's CLI features some flags to help you get moving:
|
||||||
|
|
||||||
|
`-h` - prints the help message.
|
||||||
|
|
||||||
|
`-c /path/to/config.toml` - specify a path to a configuration file.
|
||||||
|
|
||||||
|
`-i` - install a new configuration file.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
Currently this project is targeting Java 11 LTS and uses Maven to manage the software lifecycle. Thus, you must have a Java 11 JDK and Maven installed to build this project.
|
Currently this project is targeting Java 17 LTS and uses Maven to manage the software lifecycle. Thus, you must have a Java 17 JDK and Maven installed to build this project.
|
||||||
|
|
||||||
*NOTE:* The targeted Java version will likely change to 17 LTS soon.
|
|
||||||
|
|
||||||
### Ubuntu
|
### Ubuntu
|
||||||
|
|
||||||
`sudo apt install openjdk-11-jdk maven`
|
`sudo apt install openjdk-17-jdk maven`
|
||||||
|
|
||||||
### Red Hat/Almalinux
|
### Red Hat/Almalinux
|
||||||
|
|
||||||
`sudo dnf install java-11-openjdk-devel maven`
|
`sudo dnf install java-17-openjdk-devel maven`
|
||||||
|
|
||||||
### Actually Building
|
### Actually Building
|
||||||
|
|
||||||
@ -25,18 +75,3 @@ Now that the needed tools are installed, you should be able to build this projec
|
|||||||
Then you can run the transcoder:
|
Then you can run the transcoder:
|
||||||
|
|
||||||
`java -jar target/Dragon-VERSION-jar-with-dependencies.jar`
|
`java -jar target/Dragon-VERSION-jar-with-dependencies.jar`
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
If you were paying attention to Dragoon's output, you would have noticed that it failed with a complaint about not finding a configuration file. The location might move in the future or even be configurable, but for now you need to have a TOML file located at `~/.config/dragoon.toml` with at minimum the following contents:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
# This example transcodes footage to DNxHD 1080p60 for use in video editors like DaVinci Resolve.
|
|
||||||
[transcoder]
|
|
||||||
repo_path = '~/videos' # location of the videos to transcode
|
|
||||||
video_format = 'mov' # video container format
|
|
||||||
video_codec = 'dnxhd' # video codec to use
|
|
||||||
video_parameters = 'scale=1920x1080,fps=60,format=yuv422p' # video extra format parameters flag - this will be broken later into separate attributes
|
|
||||||
video_profile = 'dnxhr_hq' # DNxHD has multiple presets for various video qualities
|
|
||||||
audio_codec = 'pcm_s16le' # audio codec to use
|
|
||||||
```
|
|
||||||
|
30
pom.xml
30
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>tech.bitgoblin</groupId>
|
<groupId>tech.bitgoblin</groupId>
|
||||||
<artifactId>dragoon</artifactId>
|
<artifactId>dragoon</artifactId>
|
||||||
<version>0.3.2</version>
|
<version>0.3.13</version>
|
||||||
|
|
||||||
<name>Dragoon</name>
|
<name>Dragoon</name>
|
||||||
<url>https://www.bitgoblin.tech</url>
|
<url>https://www.bitgoblin.tech</url>
|
||||||
@ -37,8 +37,8 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -55,12 +55,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-api</artifactId>
|
<artifactId>log4j-api</artifactId>
|
||||||
<version>2.17.2</version>
|
<version>2.19.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-core</artifactId>
|
<artifactId>log4j-core</artifactId>
|
||||||
<version>2.17.2</version>
|
<version>2.19.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
@ -146,8 +146,7 @@
|
|||||||
<debBaseDir>${project.basedir}/src/build/deb</debBaseDir>
|
<debBaseDir>${project.basedir}/src/build/deb</debBaseDir>
|
||||||
<installDir>/opt</installDir>
|
<installDir>/opt</installDir>
|
||||||
<osDependencies>
|
<osDependencies>
|
||||||
<openjdk-11-jdk></openjdk-11-jdk>
|
<openjdk-17-jre></openjdk-17-jre>
|
||||||
<maven></maven>
|
|
||||||
<ffmpeg></ffmpeg>
|
<ffmpeg></ffmpeg>
|
||||||
</osDependencies>
|
</osDependencies>
|
||||||
<javaServiceWrapper>false</javaServiceWrapper>
|
<javaServiceWrapper>false</javaServiceWrapper>
|
||||||
@ -183,7 +182,7 @@
|
|||||||
<packager>Bit Goblin</packager>
|
<packager>Bit Goblin</packager>
|
||||||
<prefix>/opt</prefix>
|
<prefix>/opt</prefix>
|
||||||
<changelogFile>${project.basedir}/src/build/changelog.txt</changelogFile>
|
<changelogFile>${project.basedir}/src/build/changelog.txt</changelogFile>
|
||||||
<targetOs>linux</targetOs>
|
<targetOs>${os.name}</targetOs>
|
||||||
<mappings>
|
<mappings>
|
||||||
<mapping>
|
<mapping>
|
||||||
<directory>/opt/dragoon</directory>
|
<directory>/opt/dragoon</directory>
|
||||||
@ -202,6 +201,17 @@
|
|||||||
</source>
|
</source>
|
||||||
</sources>
|
</sources>
|
||||||
</mapping>
|
</mapping>
|
||||||
|
<mapping>
|
||||||
|
<directory>/opt/dragoon/log4j2.xml</directory>
|
||||||
|
<filemode>755</filemode>
|
||||||
|
<username>dragoon</username>
|
||||||
|
<groupname>dragoon</groupname>
|
||||||
|
<sources>
|
||||||
|
<source>
|
||||||
|
<location>${basedir}/src/build/deb/opt/dragoon/log4j2.xml</location>
|
||||||
|
</source>
|
||||||
|
</sources>
|
||||||
|
</mapping>
|
||||||
<mapping>
|
<mapping>
|
||||||
<directory>/etc/dragoon</directory>
|
<directory>/etc/dragoon</directory>
|
||||||
<configuration>true</configuration>
|
<configuration>true</configuration>
|
||||||
@ -227,8 +237,8 @@
|
|||||||
</mapping>
|
</mapping>
|
||||||
</mappings>
|
</mappings>
|
||||||
<requires>
|
<requires>
|
||||||
<require>java-11-openjdk</require>
|
<require>java-17-openjdk</require>
|
||||||
<require>ffmpeg</require>
|
<require>ffmpeg-free</require>
|
||||||
</requires>
|
</requires>
|
||||||
<preinstallScriptlet>
|
<preinstallScriptlet>
|
||||||
<script>echo "installing ${project.name} now"</script>
|
<script>echo "installing ${project.name} now"</script>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# This example transcodes footage to DNxHD 1080p60 for use in video editors like DaVinci Resolve.
|
# This example transcodes footage to DNxHD 1080p60 for use in video editors like DaVinci Resolve.
|
||||||
[transcoder]
|
[transcoder]
|
||||||
repo_path = '~/videos' # location of the videos to transcode
|
repo_path = '~/videos' # location of the videos to transcode
|
||||||
|
interval = 30
|
||||||
video_format = 'mov' # video container format
|
video_format = 'mov' # video container format
|
||||||
video_codec = 'dnxhd' # video codec to use
|
video_codec = 'dnxhd' # video codec to use
|
||||||
video_parameters = 'scale=1920x1080,fps=60,format=yuv422p' # video extra format parameters flag - this will be broken later into separate attributes
|
video_parameters = 'scale=1920x1080,fps=60,format=yuv422p' # video extra format parameters flag - this will be broken later into separate attributes
|
||||||
|
@ -4,7 +4,7 @@ Description=Dragoon video transcoder service
|
|||||||
[Service]
|
[Service]
|
||||||
User=dragoon
|
User=dragoon
|
||||||
Group=dragoon
|
Group=dragoon
|
||||||
ExecStart=/usr/bin/java -jar '/opt/dragoon/dragoon.jar'
|
ExecStart=/usr/bin/java -Dlog4j.configurationFile=/opt/dragoon/log4j2.xml -jar '/opt/dragoon/dragoon.jar' -c '/etc/dragoon/config.toml'
|
||||||
SuccessExitStatus=143
|
SuccessExitStatus=143
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
20
src/build/deb/opt/dragoon/log4j2.xml
Normal file
20
src/build/deb/opt/dragoon/log4j2.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Configuration status="info" name="Dragoon" packages="">
|
||||||
|
<Appenders>
|
||||||
|
<File name="DragoonLog" fileName="/opt/dragoon/logs/dragoon.log">
|
||||||
|
<PatternLayout>
|
||||||
|
<Pattern>%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n</Pattern>
|
||||||
|
</PatternLayout>
|
||||||
|
</File>
|
||||||
|
<Console name="Console" target="SYSTEM_OUT">
|
||||||
|
<PatternLayout
|
||||||
|
pattern="%highlight{%d [%t] %-5level: %msg%n%throwable}" />
|
||||||
|
</Console>
|
||||||
|
</Appenders>
|
||||||
|
<Loggers>
|
||||||
|
<Root level="info">
|
||||||
|
<AppenderRef ref="DragoonLog"/>
|
||||||
|
<AppenderRef ref="Console"/>
|
||||||
|
</Root>
|
||||||
|
</Loggers>
|
||||||
|
</Configuration>
|
@ -4,6 +4,6 @@ import org.apache.logging.log4j.LogManager;
|
|||||||
|
|
||||||
public class Logger {
|
public class Logger {
|
||||||
|
|
||||||
public static org.apache.logging.log4j.Logger logger = LogManager.getLogger();
|
public static org.apache.logging.log4j.Logger logger = LogManager.getRootLogger();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,78 @@
|
|||||||
package tech.bitgoblin.config;
|
package tech.bitgoblin.config;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
|
||||||
import org.apache.commons.cli.*;
|
import org.apache.commons.cli.*;
|
||||||
|
|
||||||
|
import tech.bitgoblin.Logger;
|
||||||
|
import tech.bitgoblin.io.IOUtils;
|
||||||
|
|
||||||
public class Cmd {
|
public class Cmd {
|
||||||
|
|
||||||
private String configPath = "/etc/dragoon/config.toml";
|
private String helpHeader = "Start the Dragoon video transcoder.";
|
||||||
|
private String helpFooter = "Report issues at https://git.metaunix.net/BitGoblin/dragoon/issues/";
|
||||||
|
|
||||||
|
private String configPath = "~/.config/dragoon.toml";
|
||||||
|
|
||||||
public Cmd(String[] args) throws ParseException {
|
public Cmd(String[] args) throws ParseException {
|
||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
|
|
||||||
Option configPath = new Option("c", "configPath", true, "configuration file path (defaults to /etc/dragoon/config.toml)");
|
// print help for the user
|
||||||
configPath.setRequired(false);
|
Option helpOption = new Option("h", "help", false, "Display CLI usage and options.");
|
||||||
options.addOption(configPath);
|
options.addOption(helpOption);
|
||||||
|
|
||||||
CommandLineParser parser = new DefaultParser();
|
// install a config file in the user's home directory
|
||||||
HelpFormatter formatter = new HelpFormatter();
|
Option installOption = new Option("i", "install", false, "Install configuration file in the user's home directory (or specify a location with -c).");
|
||||||
CommandLine cmd = parser.parse(options, args);
|
options.addOption(installOption);
|
||||||
|
|
||||||
// set the configPath variable if the option was passed to the program
|
// allow the user to specify a config file manually
|
||||||
if (cmd.hasOption("configPath")) {
|
Option configPath = new Option("c", "configPath", true, "Configuration file path (defaults to " + this.configPath + ")");
|
||||||
this.configPath = cmd.getOptionValue("configPath");
|
configPath.setRequired(false);
|
||||||
}
|
options.addOption(configPath);
|
||||||
|
|
||||||
|
CommandLineParser parser = new DefaultParser();
|
||||||
|
CommandLine cmd = parser.parse(options, args);
|
||||||
|
|
||||||
|
// check if the help option was called
|
||||||
|
if (cmd.hasOption("help")) {
|
||||||
|
this.printHelp(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if the install option was called
|
||||||
|
if (cmd.hasOption("install")) {
|
||||||
|
try {
|
||||||
|
this.installConfig();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Logger.logger.error("Unable to install new configuration file; please refer to the stack trace above to resolve the error.");
|
||||||
|
System.exit(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the configPath variable if the option was passed to the program
|
||||||
|
if (cmd.hasOption("configPath")) {
|
||||||
|
this.configPath = cmd.getOptionValue("configPath");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void printHelp(Options options) {
|
||||||
|
HelpFormatter formatter = new HelpFormatter();
|
||||||
|
formatter.printHelp("Dragoon", this.helpHeader, options, this.helpFooter, true);
|
||||||
|
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void installConfig() throws IOException {
|
||||||
|
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
|
||||||
|
InputStream is = classloader.getResourceAsStream("example.config");
|
||||||
|
Files.copy(is, Paths.get(IOUtils.resolveTilda(this.configPath)), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
Logger.logger.info("A new configuration file has been installed at " + this.configPath + ".");
|
||||||
|
|
||||||
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConfigPath() {
|
public String getConfigPath() {
|
||||||
|
@ -63,18 +63,28 @@ public class Transcoder {
|
|||||||
String filename = Paths.get(filePath).getFileName().toString();
|
String filename = Paths.get(filePath).getFileName().toString();
|
||||||
String outputPath = Paths.get(this.repo.getOutputPath(), String.format("%s.mov", filename)).toString();
|
String outputPath = Paths.get(this.repo.getOutputPath(), String.format("%s.mov", filename)).toString();
|
||||||
|
|
||||||
String cmd = String.format("%s -i %s -y -f %s -c:v %s -vf %s -profile:v %s -c:a %s %s",
|
// build the custom video parameters string
|
||||||
this.ffmpeg_path, // FFMPEG binary path
|
String videoParameters = String.format("scale=%s,fps=%s,format=%s",
|
||||||
sourceFile.toString(), // input file
|
this.config.getString("transcoder.video_resolution"), // video resolution
|
||||||
this.config.getString("transcoder.video_format"), // video container format
|
this.config.getString("transcoder.video_framerate"), // video frame rate
|
||||||
this.config.getString("transcoder.video_codec"), // video codec
|
this.config.getString("transcoder.video_color") // video color format
|
||||||
this.config.getString("transcoder.video_parameters"), // video format
|
|
||||||
this.config.getString("transcoder.video_profile"), // video profile
|
|
||||||
this.config.getString("transcoder.audio_codec"), // audio codec
|
|
||||||
outputPath // output file path
|
|
||||||
);
|
);
|
||||||
|
|
||||||
ProcessBuilder pb = new ProcessBuilder(cmd.split("\\s+"));
|
String cmd = String.format("%s -i INPUT_FILE -y -f %s -c:v %s -vf %s -profile:v %s -c:a %s OUTPUT_FILE",
|
||||||
|
this.ffmpeg_path, // FFMPEG binary path
|
||||||
|
this.config.getString("transcoder.video_format"), // video container format
|
||||||
|
this.config.getString("transcoder.video_codec"), // video codec
|
||||||
|
videoParameters, // custom video parameters
|
||||||
|
this.config.getString("transcoder.video_profile"), // video profile
|
||||||
|
this.config.getString("transcoder.audio_codec") // audio codec
|
||||||
|
);
|
||||||
|
|
||||||
|
String[] cmdArr = cmd.split("\\s+");
|
||||||
|
cmdArr[2] = sourceFile.toString();
|
||||||
|
cmdArr[cmdArr.length - 1] = outputPath;
|
||||||
|
System.out.println(String.join(" ", cmdArr));
|
||||||
|
|
||||||
|
ProcessBuilder pb = new ProcessBuilder(cmdArr);
|
||||||
pb.inheritIO(); // use the java processes' input and output streams
|
pb.inheritIO(); // use the java processes' input and output streams
|
||||||
try {
|
try {
|
||||||
Process process = pb.start();
|
Process process = pb.start();
|
||||||
|
10
src/main/resources/example.config
Normal file
10
src/main/resources/example.config
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[transcoder]
|
||||||
|
repo_path = '~/dragoon'
|
||||||
|
interval = 15
|
||||||
|
video_format = 'mov'
|
||||||
|
video_codec = 'dnxhd'
|
||||||
|
video_profile = 'dnxhr_hq'
|
||||||
|
video_resolution = '1920x1080'
|
||||||
|
video_framerate = '60'
|
||||||
|
video_color = 'yuv422p'
|
||||||
|
audio_codec = 'pcm_s16le'
|
@ -9,9 +9,9 @@ import org.apache.commons.cli.ParseException;
|
|||||||
public class CmdTest {
|
public class CmdTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldDefaultToEtc() throws ParseException {
|
public void shouldDefaultToHome() throws ParseException {
|
||||||
Cmd cmd = new Cmd(new String[]{});
|
Cmd cmd = new Cmd(new String[]{});
|
||||||
assertTrue(cmd.getConfigPath().equals("/etc/dragoon/config.toml"));
|
assertTrue(cmd.getConfigPath().equals("~/.config/dragoon.toml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user