소스 검색

all times now in seconds. overlay operation basics are working.

master
Jonathan Cobb 3 년 전
부모
커밋
b2c830ed4e
8개의 변경된 파일25개의 추가작업 그리고 14개의 파일을 삭제
  1. +1
    -1
      README.md
  2. +1
    -1
      src/main/java/jvcl/main/Jvcl.java
  3. +3
    -1
      src/main/java/jvcl/main/JvclOptions.java
  4. +3
    -3
      src/main/java/jvcl/service/Toolbox.java
  5. +12
    -3
      src/test/resources/tests/test_overlay.jvcl
  6. +2
    -2
      src/test/resources/tests/test_split.jvcl
  7. +2
    -2
      src/test/resources/tests/test_trim.jvcl
  8. +1
    -1
      utils/cobbzilla-utils

+ 1
- 1
README.md 파일 보기

@@ -174,7 +174,7 @@ Here is a complex example using multiple assets and operations.
"operation": "split", // name of the operation,
"creates": "vid1_split_%", // assets it creates, the '%' will be replaced with a counter
"split": "vid1", // split this source asset
"interval": "10s" // split every ten seconds
"interval": "10" // split every ten seconds
},
{
"operation": "concat", // name of the operation,


+ 1
- 1
src/main/java/jvcl/main/Jvcl.java 파일 보기

@@ -31,7 +31,7 @@ public class Jvcl extends BaseMain<JvclOptions> {

final Toolbox toolbox = Toolbox.DEFAULT_TOOLBOX;

final AssetManager assetManager = new AssetManager(toolbox, getOptions().getScratchDir());
final AssetManager assetManager = new AssetManager(toolbox, getOptions().scratchDir());
Arrays.stream(spec.getAssets()).forEach(assetManager::defineAsset);

final OperationEngine opEngine = new OperationEngine(toolbox, assetManager);


+ 3
- 1
src/main/java/jvcl/main/JvclOptions.java 파일 보기

@@ -4,6 +4,7 @@ import jvcl.model.JSpec;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.cobbzilla.util.io.TempDir;
import org.cobbzilla.util.main.BaseMainOptions;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
@@ -44,6 +45,7 @@ public class JvclOptions extends BaseMainOptions {
public static final String OPT_SCRATCH_DIR = "-t";
public static final String LONGOPT_SCRATCH_DIR = "--temp-dir";
@Option(name=OPT_SCRATCH_DIR, aliases=LONGOPT_SCRATCH_DIR, usage=USAGE_SCRATCH_DIR)
@Getter @Setter private File scratchDir = new File("/tmp");
@Getter @Setter private File scratchDir = null;
public File scratchDir() { return scratchDir == null ? new TempDir() : scratchDir; }

}

+ 3
- 3
src/main/java/jvcl/service/Toolbox.java 파일 보기

@@ -18,12 +18,10 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import static java.math.RoundingMode.HALF_EVEN;
import static org.cobbzilla.util.daemon.ZillaRuntime.*;
import static org.cobbzilla.util.io.FileUtil.*;
import static org.cobbzilla.util.json.JsonUtil.*;
import static org.cobbzilla.util.system.CommandShell.execScript;
import static org.cobbzilla.util.time.TimeUtil.parseDuration;

@Slf4j
public class Toolbox {
@@ -44,7 +42,9 @@ public class Toolbox {
}

public static BigDecimal getDuration(String t) {
return big(parseDuration(t)).divide(big(1000), HALF_EVEN);
// we may want to support other time formats.
// for now everything is in seconds
return big(t);
}

public static Map<String, Object> jsContext(Map<String, Object> ctx) {


+ 12
- 3
src/test/resources/tests/test_overlay.jvcl 파일 보기

@@ -12,11 +12,20 @@
}
],
"operations": [
// trim videos so test runs faster
{
"operation": "trim",
"creates": "v1",
"trim": "vid1",
"start": "0"
"start": "0",
"end": "60"
},
{
"operation": "trim",
"creates": "v2",
"trim": "vid2",
"start": "10",
"end": "20"
},
{
"operation": "overlay", // name of the operation
@@ -26,11 +35,11 @@
"height": "1024", // output height in pixes. default is source height
"dest": "src/test/resources/outputs/overlay/"
},
"source": "vid1", // main video asset
"source": "v1", // main video asset
"start": "30", // when (on the main video timeline) to begin showing the overlay. default is 0 (beginning)
"end": "30 + overlay.duration", // when (on the main video timeline) to stop showing the overlay. default is to play the entire overlay
"overlay": {
"source": "vid2", // overlay this video on the main video
"source": "v2", // overlay this video on the main video
"start": "0", // when (on the overlay video timeline) to begin playback on the overlay. default is 0 (beginning)
"end": "overlay.duration", // when (on the overlay video timeline) to end playback on the overlay. default is to play the entire overlay
"width": "overlay.width / 2", // how wide the overlay will be, in pixels. default is the full overlay width, or maintain aspect ratio if height was set


+ 2
- 2
src/test/resources/tests/test_split.jvcl 파일 보기

@@ -20,8 +20,8 @@
},
"split": "vid1", // split this source asset
"interval": "10s", // split every ten seconds
"start": "65s", // start one minute and five seconds into the video
"end": "100s" // end 100 seconds into the video
"start": "65", // start one minute and five seconds into the video
"end": "100" // end 100 seconds into the video
}
]
}

+ 2
- 2
src/test/resources/tests/test_trim.jvcl 파일 보기

@@ -10,8 +10,8 @@
"dest": "src/test/resources/outputs/trims/"
},
"trim": "vid1_splits", // trim these source assets
"start": "1s", // cropped region starts here, default is zero
"end": "6s" // cropped region ends here, default is end of video
"start": "1", // cropped region starts here, default is zero
"end": "6" // cropped region ends here, default is end of video
}
]
}

+ 1
- 1
utils/cobbzilla-utils

@@ -1 +1 @@
Subproject commit 64ef7809a0b7c8a2c34311092d606c75df36a9a7
Subproject commit a31b3687f1286dac404e99f4a9835323ab6c0329

불러오는 중...
취소
저장