Skip to content

Latest commit

 

History

History
163 lines (133 loc) · 24.3 KB

index.md

File metadata and controls

163 lines (133 loc) · 24.3 KB

subkt / myaa.subkt.tasks / Mux

Mux

open class Mux : PropertyTask (source)

Task to mux a set of files into a single Matroska container using mkvmerge.

A predefined task instance can be accessed through Subs.mux.

mux {
    title("My Show - 01")
    forceCRC("DEADBEEF")

    from("video.mkv") {
        includeChapters(false)

        tracks {
            include(track.type == TrackType.VIDEO)
            name("Video")
            default(true)
        }

        attachments {
            include(false)
        }
    }

    from("audio.aac") {
        tracks {
            name("Audio")
            lang("jpn")
            default(true)
        }
    }

    from("commentary.aac") {
        tracks {
            name("Commentary")
            lang("jpn")
            delay(1000)
        }
    }

    from("subtitles.ass") {
        tracks {
            name("English")
            lang("eng")
            default(true)
        }
    }

    chapters("chapters.txt") {
        lang("eng")
    }

    attach("fonts") {
        includeExtensions("ttf", "otf")
    }

    out("My Show - 01.mkv")
}

Types

Name Summary
Attachment inner class Attachment : Filterable
Represents an attachment present in a MuxFile.
Chapter inner class Chapter
Represents a chapter file to mux, added using chaptersProperty.
CompressionType enum class CompressionType
The type of compression to use, for use with Track.compression.
Dimensions data class Dimensions : Serializable
Represents the dimensions of a track in pixels.
MuxFile inner class MuxFile
Represents a file to mux, added using from.
Track inner class Track : Filterable
Represents a single track read from the source file.
TrackDuration data class TrackDuration : Serializable
Represents a duration for use with Track.defaultDuration.
TrackType enum class TrackType
The type of a track, available through Track.TrackInfo.type.

Constructors

Name Summary
<init> Mux()
Task to mux a set of files into a single Matroska container using mkvmerge.

Properties

Name Summary
attachmentsProperty val attachmentsProperty: Provider<List<FileCollection>>
The files to attach, added via attach.
chaptersProperty val chaptersProperty: Provider<Mux.Chapter>
The chapters of the file, added via chapters.
crc var crc: String
The CRC32 hash of the output file. Only available after the task has finished.
defaultLanguage val defaultLanguage: Property<String>
The default language used for tracks which don't have a language specified. If not set, mkvmerge will default to und.
deterministic val deterministic: Property<Boolean>
If true, a fixed value will be used as the RNG seed for generating UIDs, and mkvmerge will not write the current date and time to the output file. This means that for the same input files, flags and mkvmerge version, the output file will always be byte identical. Thus, even if you have to rerun tasks for whatever reason, you know that the same CRC32 will be generated unless the input files have changed.
deterministicSeed val deterministicSeed: Property<Long>
The seed to use for --deterministic -- see deterministic. If not set, a hash based on the output filename will be used.
filesProperty val filesProperty: Provider<List<Mux.MuxFile>>
The files to mux, added via from.
forceCRC val forceCRC: Property<String>
Forces the CRC32 hash of the file to be equal to the set value. Must be a 8 character long hex string, containing only digits and letters in the range A-F.
globalOptions val globalOptions: ListProperty<String>
Any additional global mkvmerge options you wish to include.
info var info: MutableMap<String, Any>
Information about the output file as returned by mkvinfo -J. See the mkvmerge identification output schema. Additionally, the map contains the keys video_tracks, audio_tracks and subtitles_tracks which are lists of tracks of the respective types.
inputFiles val inputFiles: FileCollection
All files added via from, attach or chapters.
mimeTypes val mimeTypes: MutableMap<String, String>
Overrides the MIME types autodetected by mkvmerge for files attached via attach, on a file extension basis. E.g. to force all files ending with .txt to have MIME type text/html, you can run:
mkvmerge val mkvmerge: Property<String>
Path to the mkvmerge command. Defaults to mkvmerge, and assumes the command is present in your PATH.
onFaux val onFaux: Property<ErrorMode>
If verifyFonts is true, controls what to do if an instance of faux bold or faux italic is encountered. Defaults to ErrorMode.WARN.
onMissingFonts val onMissingFonts: Property<ErrorMode>
If verifyFonts is true, controls what to do if a missing font is encountered. Defaults to ErrorMode.FAIL.
onMissingGlyphs val onMissingGlyphs: Property<ErrorMode>
If verifyFonts is true, controls what to do if missing glyphs are encountered. Defaults to ErrorMode.FAIL.
onStyleMismatch val onStyleMismatch: Property<ErrorMode>
If verifyFonts is true, controls what to do if the matched font differs from the requested style (e.g. non-italic was requested, but only italic found). Defaults to ErrorMode.WARN.
out val out: ConfigurableFileCollection
The location to save the MKV file. Defaults to an automatically generated file in the build directory.
outFile val outFile: Provider<File>
Read-only alias of out.
skipUnusedFonts val skipUnusedFonts: Property<Boolean>
If true, will not attach any font files that are not used in any of the attached subtitle tracks. Defaults to false.
title val title: Property<String>
The title of the file. Will generally show up in e.g. the window title of the video player.
verifyCRC val verifyCRC: Property<Boolean>
If true, will verify the CRC of input files that have a CRC specified in square brackets, e.g. premux [DEADBEEF].mkv. Defaults to true.
verifyFonts val verifyFonts: Property<Boolean>
If true, will warn about font issues in included subtitle tracks. You can configure the error reporting using onFaux, onStyleMismatch, onMissingGlyphs and onMissingFonts. Defaults to true.
webm val webm: Property<Boolean>
Whether to output a WebM compliant file. Defaults to false.

Inherited Properties

Name Summary
propertyFile val propertyFile: File

Functions

Name Summary
attach fun attach(vararg dirs: Any, action: ConfigurableFileTree.() -> Unit= {}):Provider<List<ConfigurableFileTree>>
Attach one or more files to the output file.
chapters fun chapters(file: Any, action: Mux.Chapter.() -> Unit= {}):Provider<Mux.Chapter>
Adds a chapter file.
from fun from(vararg files: Any, action: Mux.MuxFile.() -> Unit= {}):Provider<List<Mux.MuxFile>>
Adds files to mux.
run open fun run(): Unit

Inherited Functions

Name Summary
doTask fun doTask(): Unit

Extension Properties

Name Summary
batch val Task.batch: String
The same as entry if this is a batch task; error otherwise.
currentTask val Task.currentTask: String
The name of this task.
entry val Task.entry: String
The entry (batch or episode) this task corresponds to.
episode val Task.episode: String
The same as entry if this is an episode task; error otherwise.
episodes val Task.episodes: List<String>
The episodes this task corresponds to. A single-item list containing episode if this is an episode task; a list of the episodes for the batch given by batch otherwise.
isBatch val Task.isBatch: Boolean
True if this task is a batch task.
release val Task.release: String
The release this task was generated for.
taskGroup val <T : Task> T.taskGroup: TaskGroup<T>
The TaskGroup instance this task belongs to.

Extension Functions

Name Summary
defaultProperty fun <T> Task.defaultProperty(default: T): Property<T>
Returns a Property with a default value set.
evaluate fun Task.evaluate(expression: String): Provider<List<String>!>!
Evaluates a string using Velocity, splits it on `
evaluateTemplate fun Task.evaluateTemplate(expression: String): Provider<String!>!
Like evaluate but only processes the template syntax, without globbing.
get fun Task.get(propertyName: String): Provider<String!>!
Searches for the given property in the Subs object's SubProperties instance, evaluates its value using evaluate, and returns a single string, assuming that the resulting list contains only one element.
getAs fun <T> Task.getAs(propertyName: String): Provider<T>!
Searches for the given property in the Subs object's SubProperties instance, evaluates its value using evaluate, and returns a single string, cast to the given type using String.asType, assuming that the resulting list contains only one element.
getFile fun Task.getFile(filename: String): Provider<String!>!
fun Task.getFile(filename: Provider<String>): Provider<String!>!
Reads the specified file and processes it using Velocity.
getList fun Task.getList(propertyName: String): Provider<List<String>>
Searches for the given property in the Subs object's SubProperties instance, and evaluates its value using evaluate.
getListAs fun <T> Task.getListAs(propertyName: String): Provider<List<T>!>!
Searches for the given property in the Subs object's SubProperties instance, evaluates its value using evaluate, and casts the list elements to the given type using String.asType.
getRaw fun Task.getRaw(propertyName: String): String
Searches for the given property in the Subs object's SubProperties instance, and returns the raw string. Raises an error if not found.
getRawMaybe fun Task.getRawMaybe(propertyName: String): String?
Searches for the given property in the Subs object's SubProperties instance, and returns the raw string, possibly null.
outputFile fun Task.outputFile(extension: String): ConfigurableFileCollection
Returns a ConfigurableFileCollection containing a single file taskName.extension located in the build directory.
propertyExists fun Task.propertyExists(propertyName: String): Boolean
Returns true if the given property exists in the Subs object's SubProperties instance for the given context.