+
+
+
diff --git a/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/LICENSES.md b/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/LICENSES.md
new file mode 100644
index 00000000..8798e4e3
--- /dev/null
+++ b/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/LICENSES.md
@@ -0,0 +1,3 @@
+### Licenses
+
+* TODO - The FFmpeg transformer uses FFmpeg. See license: https://github.com/FFmpeg/FFmpeg/blob/master/LICENSE.md
\ No newline at end of file
diff --git a/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/pom.xml b/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/pom.xml
new file mode 100644
index 00000000..a80073cf
--- /dev/null
+++ b/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/pom.xml
@@ -0,0 +1,38 @@
+
+ 4.0.0
+ alfresco-transform-ffmpeg
+ Alfresco FFmpeg Transformer
+ jar
+
+
+ org.alfresco
+ alfresco-transform-core
+ 2.3.3-SNAPSHOT
+ ../../pom.xml
+
+
+
+
+ org.alfresco
+ alfresco-transformer-base
+ ${project.version}
+
+
+
+
+
+
+ org.codehaus.mojo
+ license-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+
diff --git a/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/src/main/java/org/alfresco/transformer/FFmpegOptionsBuilder.java b/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/src/main/java/org/alfresco/transformer/FFmpegOptionsBuilder.java
new file mode 100644
index 00000000..e06ce878
--- /dev/null
+++ b/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/src/main/java/org/alfresco/transformer/FFmpegOptionsBuilder.java
@@ -0,0 +1,53 @@
+/*
+ * #%L
+ * Alfresco Transform Core
+ * %%
+ * Copyright (C) 2005 - 2020 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.transformer;
+
+import java.util.StringJoiner;
+
+/**
+ * FFmpeg options builder.
+ *
+ * @author janv
+ */
+// TODO PoC for FFmpeg
+public final class FFmpegOptionsBuilder
+{
+ // TODO PoC - add FFmpeg options ...
+ private FFmpegOptionsBuilder() {}
+
+ public String build()
+ {
+ StringJoiner args = new StringJoiner(" ");
+
+ return args.toString();
+ }
+
+ public static FFmpegOptionsBuilder builder()
+ {
+ return new FFmpegOptionsBuilder();
+ }
+}
diff --git a/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/src/main/java/org/alfresco/transformer/executors/FFmpegCommandExecutor.java b/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/src/main/java/org/alfresco/transformer/executors/FFmpegCommandExecutor.java
new file mode 100644
index 00000000..3dcaffb4
--- /dev/null
+++ b/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/src/main/java/org/alfresco/transformer/executors/FFmpegCommandExecutor.java
@@ -0,0 +1,114 @@
+/*
+ * #%L
+ * Alfresco Transform Core
+ * %%
+ * Copyright (C) 2005 - 2020 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.transformer.executors;
+
+import org.alfresco.transform.exceptions.TransformException;
+import org.alfresco.transformer.FFmpegOptionsBuilder;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.alfresco.transformer.util.RequestParamMap.TIMEOUT;
+import static org.alfresco.transformer.util.Util.stringToLong;
+
+/**
+ * CommandExecutor implementation for running FFmpeg transformations. It runs the
+ * transformation logic as a separate Shell process.
+ */
+// TODO PoC for FFmpeg
+public class FFmpegCommandExecutor extends AbstractCommandExecutor
+{
+ private static String ID = "ffmpeg";
+
+ // TODO PoC for FFmpeg
+ public static final String LICENCE = "TODO: This transformer uses Ffmpeg. See the license at ...";
+
+ private final String EXE;
+
+ public FFmpegCommandExecutor(String exe)
+ {
+ if (exe == null || exe.isEmpty())
+ {
+ throw new IllegalArgumentException("FfmpegCommandExecutor EXE variable cannot be null or empty");
+ }
+ this.EXE = exe;
+ super.transformCommand = createTransformCommand();
+ super.checkCommand = createCheckCommand();
+ }
+
+ @Override
+ public String getTransformerId()
+ {
+ return ID;
+ }
+
+ @Override
+ protected RuntimeExec createTransformCommand()
+ {
+ RuntimeExec runtimeExec = new RuntimeExec();
+ Map commandsAndArguments = new HashMap<>();
+
+ // TODO PoC for FFmpeg - check against Gytheio: -y SPLIT:${sourceOptions} -i ${source} SPLIT:${targetOptions} ${target}
+ commandsAndArguments.put(".*",
+ new String[]{EXE, "-y", "-i", "SPLIT:${options}", "${source}", "${target}"});
+
+ runtimeExec.setCommandsAndArguments(commandsAndArguments);
+
+ Map defaultProperties = new HashMap<>();
+ defaultProperties.put("key", null);
+ runtimeExec.setDefaultProperties(defaultProperties);
+
+ runtimeExec.setErrorCodes("1");
+
+ return runtimeExec;
+ }
+
+ @Override
+ protected RuntimeExec createCheckCommand()
+ {
+ RuntimeExec runtimeExec = new RuntimeExec();
+ Map commandsAndArguments = new HashMap<>();
+ commandsAndArguments.put(".*", new String[]{EXE, "--version"});
+ runtimeExec.setCommandsAndArguments(commandsAndArguments);
+ return runtimeExec;
+ }
+
+ @Override
+ public void transform(String transformName, String sourceMimetype, String targetMimetype,
+ Map transformOptions,
+ File sourceFile, File targetFile) throws TransformException
+ {
+ final String options = FFmpegOptionsBuilder
+ .builder()
+ .build();
+
+ Long timeout = stringToLong(transformOptions.get(TIMEOUT));
+
+ run(options, sourceFile, targetFile, timeout);
+ }
+}
diff --git a/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/src/main/resources/ffmpeg_engine_config.json b/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/src/main/resources/ffmpeg_engine_config.json
new file mode 100644
index 00000000..1d1cec34
--- /dev/null
+++ b/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg/src/main/resources/ffmpeg_engine_config.json
@@ -0,0 +1,18 @@
+{
+ "transformOptions": {
+ "ffmpegOptions": [
+ ]
+ },
+ "transformers": [
+ {
+ "transformerName": "ffmpeg",
+ "supportedSourceAndTargetList": [
+ {"sourceMediaType": "video/mp4", "targetMediaType": "video/avi" },
+ {"sourceMediaType": "video/mp4", "targetMediaType": "audio/mp3" }
+ ],
+ "transformOptions": [
+ "ffmpegOptions"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index e4ef83cb..60d3ed02 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,6 +45,8 @@
alfresco-transformer-basealfresco-transform-imagemagick/alfresco-transform-imagemagickalfresco-transform-imagemagick/alfresco-transform-imagemagick-boot
+ alfresco-transform-ffmpeg/alfresco-transform-ffmpeg
+ alfresco-transform-ffmpeg/alfresco-transform-ffmpeg-bootalfresco-transform-libreoffice/alfresco-transform-libreofficealfresco-transform-libreoffice/alfresco-transform-libreoffice-bootalfresco-transform-misc/alfresco-transform-misc
@@ -71,6 +73,14 @@
alfresco-transform-imagemagick/alfresco-transform-imagemagick-boot
+
+ ffmpeg
+
+ alfresco-transformer-base
+ alfresco-transform-ffmpeg/alfresco-transform-ffmpeg
+ alfresco-transform-ffmpeg/alfresco-transform-ffmpeg-boot
+
+ libreoffice