diff --git a/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg-boot/src/main/resources/templates/transformForm.html b/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg-boot/src/main/resources/templates/transformForm.html
index e36c6f20..8b682a78 100644
--- a/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg-boot/src/main/resources/templates/transformForm.html
+++ b/alfresco-transform-ffmpeg/alfresco-transform-ffmpeg-boot/src/main/resources/templates/transformForm.html
@@ -7,12 +7,16 @@
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
index 35ce1156..955b94b1 100644
--- 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
@@ -29,26 +29,29 @@ package org.alfresco.transformer;
import java.util.StringJoiner;
/**
- * FFmpeg options builder.
+ * FFmpeg options builder
*
+ * https://ffmpeg.org/ffmpeg.html#Options including:
+ * - https://ffmpeg.org/ffmpeg.html#Main-options
+ * - https://ffmpeg.org/ffmpeg.html#Video-Options
+ * - https://ffmpeg.org/ffmpeg-utils.html#time-duration-syntax
+ *
* @author janv
*/
-// TODO PoC for FFmpeg
+// TODO PoC for FFmpeg - add other FFmpeg transform options (as needed) ...
public final class FFmpegOptionsBuilder
{
- private String timeOffset;
- private String duration;
-
private Integer framesNum;
- // TODO PoC - add other FFmpeg transform options ...
- private FFmpegOptionsBuilder() {}
+ // temporal
+ private String timeOffset;
+ private String duration;
- public FFmpegOptionsBuilder withTimeOffset(final String timeOffset)
- {
- this.timeOffset = timeOffset;
- return this;
- }
+ // frame resolution
+ private Integer frameWidth;
+ private Integer frameHeight;
+
+ private FFmpegOptionsBuilder() {}
public FFmpegOptionsBuilder withFramesNum(final Integer framesNum)
{
@@ -56,31 +59,54 @@ public final class FFmpegOptionsBuilder
return this;
}
+ public FFmpegOptionsBuilder withTimeOffset(final String timeOffset)
+ {
+ this.timeOffset = timeOffset;
+ return this;
+ }
+
public FFmpegOptionsBuilder withDuration(final String duration)
{
this.duration = duration;
return this;
}
+ public FFmpegOptionsBuilder withFrameWidth(final Integer frameWidth)
+ {
+ this.frameWidth = frameWidth;
+ return this;
+ }
+
+ public FFmpegOptionsBuilder withFrameHeight(final Integer frameHeight)
+ {
+ this.frameHeight = frameHeight;
+ return this;
+ }
+
public String build()
{
StringJoiner args = new StringJoiner(" ");
- if (timeOffset != null)
- {
- args.add("-ss "+timeOffset);
- }
-
if (framesNum != null)
{
args.add("-frames:v "+framesNum);
}
+ if (timeOffset != null)
+ {
+ args.add("-ss "+timeOffset);
+ }
+
if (duration != null)
{
args.add("-t "+duration);
}
+ if ((frameWidth != null) && (frameHeight != null))
+ {
+ args.add("-s "+frameWidth+"x"+frameHeight);
+ }
+
return args.toString();
}
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
index 29054288..0dd1aafa 100644
--- 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
@@ -124,6 +124,9 @@ public class FFmpegCommandExecutor extends AbstractCommandExecutor
optionsBuilder.withDuration(transformOptions.get(DURATION));
}
+ optionsBuilder.withFrameWidth(stringToInteger(transformOptions.get(FRAME_WIDTH)));
+ optionsBuilder.withFrameHeight(stringToInteger(transformOptions.get(FRAME_HEIGHT)));
+
optionsBuilder.withFramesNum(stringToInteger(transformOptions.get(FRAMES_NUM)));
final String options = optionsBuilder.build();
diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/util/RequestParamMap.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/util/RequestParamMap.java
index 8eee968a..228afcf5 100644
--- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/util/RequestParamMap.java
+++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/util/RequestParamMap.java
@@ -73,8 +73,10 @@ public interface RequestParamMap
String NOT_EXTRACT_BOOKMARKS_TEXT = "notExtractBookmarksText";
String PAGE_LIMIT = "pageLimit";
- // TODO PoC for FFmpeg
+ // TODO PoC for FFmpeg - effectively target options (note: if we need specific source options, may need extra set)
String TIME_OFFSET = "timeOffset";
String DURATION = "duration";
String FRAMES_NUM = "framesNum";
+ String FRAME_WIDTH = "frameWidth";
+ String FRAME_HEIGHT = "frameHeight";
}