diff --git a/jave-core/src/main/java/ws/schild/jave/Encoder.java b/jave-core/src/main/java/ws/schild/jave/Encoder.java index ce626ab..0aad733 100644 --- a/jave-core/src/main/java/ws/schild/jave/Encoder.java +++ b/jave-core/src/main/java/ws/schild/jave/Encoder.java @@ -439,7 +439,9 @@ public void encode( new ValueArgument(ArgType.OUTFILE, "-crf", ea -> ea.getVideoAttributes().flatMap(VideoAttributes::getCrf).map(Object::toString)), new ValueArgument(ArgType.OUTFILE, "-preset", - ea -> ea.getVideoAttributes().flatMap(VideoAttributes::getPreset)) + ea -> ea.getVideoAttributes().flatMap(VideoAttributes::getPreset)), + new ValueArgument(ArgType.OUTFILE, "-tune", + ea -> ea.getVideoAttributes().flatMap(VideoAttributes::getTune).map(TuneEnum::getTuneName)) ) ); diff --git a/jave-core/src/main/java/ws/schild/jave/encode/VideoAttributes.java b/jave-core/src/main/java/ws/schild/jave/encode/VideoAttributes.java index c504f0a..a1f1711 100644 --- a/jave-core/src/main/java/ws/schild/jave/encode/VideoAttributes.java +++ b/jave-core/src/main/java/ws/schild/jave/encode/VideoAttributes.java @@ -47,6 +47,7 @@ public class VideoAttributes implements Serializable { * direct stream copy. */ private String codec = null; + /** The the forced tag/fourcc value for the video stream. */ private String tag = null; /** @@ -89,7 +90,9 @@ public class VideoAttributes implements Serializable { * The downside is that it is less compatible with other applications. */ private boolean faststart = false; - + + private TuneEnum tune = null; + private X264_PROFILE x264Profile = null; /** @@ -299,7 +302,18 @@ public String toString() { + quality + ")"; } - + /** @return the Tune value */ + public Optional getTune() { + return Optional.ofNullable(tune); + } + /** + * @param TuneEnum the TuneEnum to set + * @return this instance + */ + public VideoAttributes setTune(TuneEnum tune){ + this.tune = tune; + return this; + } /** @return the x264Profile */ public Optional getX264Profile() { return Optional.ofNullable(x264Profile); diff --git a/jave-core/src/main/java/ws/schild/jave/encode/enums/TuneEnum.java b/jave-core/src/main/java/ws/schild/jave/encode/enums/TuneEnum.java new file mode 100644 index 0000000..b5dc826 --- /dev/null +++ b/jave-core/src/main/java/ws/schild/jave/encode/enums/TuneEnum.java @@ -0,0 +1,20 @@ +public enum TuneEnum { + FILM("film"),//use for high quality movie content; lowers deblocking + ANIMATION("animation"),//good for cartoons; uses higher deblocking and more reference frames + GRAIN("grain"),//preserves the grain structure in old, grainy film material + STILLIMAGE("stillimage"),//good for slideshow-like content + FASTDECODE("fastdecode"),//allows faster decoding by disabling certain filters + ZEROLATENCY("zerolatency"),//good for fast encoding and low-latency streaming + PSNR("psnr"),//ignore this as it is only used for codec development + SSIM("ssim");//ignore this as it is only used for codec development + + private final String tuneName; + + TuneEnum(String tuneName) { + this.tuneName = tuneName; + } + + public String getTuneName() { + return tuneName; + } +}