Compare commits

..

No commits in common. "master" and "v0.3.6" have entirely different histories.

8 changed files with 17 additions and 68 deletions

View File

@ -2,30 +2,6 @@
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
```
## Building ## Building
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. 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.

10
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>tech.bitgoblin</groupId> <groupId>tech.bitgoblin</groupId>
<artifactId>dragoon</artifactId> <artifactId>dragoon</artifactId>
<version>0.3.12</version> <version>0.3.6</version>
<name>Dragoon</name> <name>Dragoon</name>
<url>https://www.bitgoblin.tech</url> <url>https://www.bitgoblin.tech</url>
@ -160,6 +160,10 @@
<source>${basedir}/target/dragoon-${project.version}-jar-with-dependencies.jar</source> <source>${basedir}/target/dragoon-${project.version}-jar-with-dependencies.jar</source>
<target>/opt/dragoon/dragoon.jar</target> <target>/opt/dragoon/dragoon.jar</target>
</fileSet> </fileSet>
<fileSet>
<source>${basedir}/src/main/resources/log4j2.xml</source>
<target>/opt/dragoon/log4j2.xml</target>
</fileSet>
</fileSets> </fileSets>
</configuration> </configuration>
</plugin> </plugin>
@ -208,7 +212,7 @@
<groupname>dragoon</groupname> <groupname>dragoon</groupname>
<sources> <sources>
<source> <source>
<location>${basedir}/src/build/deb/opt/dragoon/log4j2.xml</location> <location>${basedir}/src/main/resources/log4j2.xml</location>
</source> </source>
</sources> </sources>
</mapping> </mapping>
@ -238,7 +242,7 @@
</mappings> </mappings>
<requires> <requires>
<require>java-17-openjdk</require> <require>java-17-openjdk</require>
<require>ffmpeg-free</require> <require>ffmpeg</require>
</requires> </requires>
<preinstallScriptlet> <preinstallScriptlet>
<script>echo "installing ${project.name} now"</script> <script>echo "installing ${project.name} now"</script>

View File

@ -1,7 +1,6 @@
# 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

View File

@ -4,7 +4,7 @@ Description=Dragoon video transcoder service
[Service] [Service]
User=dragoon User=dragoon
Group=dragoon Group=dragoon
ExecStart=/usr/bin/java -Dlog4j.configurationFile=/opt/dragoon/log4j2.xml -jar '/opt/dragoon/dragoon.jar' -c '/etc/dragoon/config.toml' ExecStart=/usr/bin/java -jar '/opt/dragoon/dragoon.jar' -Dlog4j.configurationFile=/opt/dragoon/log4j2.xml
SuccessExitStatus=143 SuccessExitStatus=143
[Install] [Install]

View File

@ -1,20 +0,0 @@
<?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>

View File

@ -4,7 +4,7 @@ import org.apache.commons.cli.*;
public class Cmd { public class Cmd {
private String configPath = "~/.config/dragoon.toml"; private String configPath = "/etc/dragoon/config.toml";
public Cmd(String[] args) throws ParseException { public Cmd(String[] args) throws ParseException {
Options options = new Options(); Options options = new Options();

View File

@ -63,28 +63,18 @@ 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();
// build the custom video parameters string String cmd = String.format("%s -i %s -y -f %s -c:v %s -vf %s -profile:v %s -c:a %s %s",
String videoParameters = String.format("scale=%s,fps=%s,format=%s",
this.config.getString("transcoder.video_resolution"), // video resolution
this.config.getString("transcoder.video_framerate"), // video frame rate
this.config.getString("transcoder.video_color") // video color format
);
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.ffmpeg_path, // FFMPEG binary path
sourceFile.toString(), // input file
this.config.getString("transcoder.video_format"), // video container format this.config.getString("transcoder.video_format"), // video container format
this.config.getString("transcoder.video_codec"), // video codec this.config.getString("transcoder.video_codec"), // video codec
videoParameters, // custom video parameters this.config.getString("transcoder.video_parameters"), // video format
this.config.getString("transcoder.video_profile"), // video profile this.config.getString("transcoder.video_profile"), // video profile
this.config.getString("transcoder.audio_codec") // audio codec this.config.getString("transcoder.audio_codec"), // audio codec
outputPath // output file path
); );
String[] cmdArr = cmd.split("\\s+"); ProcessBuilder pb = new ProcessBuilder(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();

View File

@ -9,9 +9,9 @@ import org.apache.commons.cli.ParseException;
public class CmdTest { public class CmdTest {
@Test @Test
public void shouldDefaultToHome() throws ParseException { public void shouldDefaultToEtc() throws ParseException {
Cmd cmd = new Cmd(new String[]{}); Cmd cmd = new Cmd(new String[]{});
assertTrue(cmd.getConfigPath().equals("~/.config/dragoon.toml")); assertTrue(cmd.getConfigPath().equals("/etc/dragoon/config.toml"));
} }
} }