### Starting Encore with Docker Compose Source: https://svt.github.io/encore-doc/index.html Commands to start Encore using Docker Compose on Linux and macOS. Ensure your Docker Compose file is in the current directory. ```bash $ ./docker-compose up ``` ```bash $ ./docker compose up ``` -------------------------------- ### Basic Profile Example Source: https://svt.github.io/encore-doc/index.html A simple profile definition specifying the program and video configuration files. ```yaml program: withforcekeyframe.yml youtube: video.yml ``` -------------------------------- ### Dockerfile for Encore with FFmpeg Source: https://svt.github.io/encore-doc/index.html This Dockerfile sets up an Ubuntu environment with FFmpeg, necessary filters, and mediainfo, preparing a base image for Encore. It installs dependencies via apt-get and Homebrew, configures user permissions, and sets environment variables. ```dockerfile FROM ubuntu:20.04 ENV LC_ALL C.UTF-8 ENV LANG C.UTF-8 ENV TZ Europe/Stockholm RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ARG USR="user" RUN apt-get update && apt-get -y --no-install-recommends install \ build-essential \ curl \ sudo \ file \ locales \ ruby \ git \ expect \ openssh-client \ ca-certificates \ openjdk-11-jre-headless \ zip \ unzip RUN localedef -i en_US -f UTF-8 en_US.UTF-8 && \ useradd -ms /bin/bash ${USR} && \ echo '${USR} ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers && \ echo 'Set disable_coredump false' >> /etc/sudo.conf RUN mkdir -m777 /ffmpeg-filters RUN bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64/ RUN brew tap svt/avtools && \ brew install openssl@1.1 && \ brew unlink openssl@1.1 && \ brew install openssl@3 && \ brew install ffmpeg-encore libsvg-proxy-filter libsrf-proxy-filter mediainfo && \ sudo rm -rf "$(brew --cache)" RUN cp $(brew --prefix)/lib/libsvg_filter.so $(brew --prefix)/lib/libsrf_filter.so /ffmpeg-filters/ USER ${USR} CMD ["ffmpeg", "-version"] ``` -------------------------------- ### YouTube Upload Profile Example (x264) Source: https://svt.github.io/encore-doc/index.html A profile configured for YouTube uploads using the x264 codec, featuring CRF-based quality and specific audio settings. ```yaml name: youtube description: Youtube upload encodes: - type: X264Encode suffix: 10000 twoPass: false height: 1080 params: crf: 15 r: 25 vsync: 1 pix_fmt: yuv420p profile:v: high level: 5.1 x264-params: vbv-maxrate: 10000 vbv-bufsize: 20000 deblock: 0,0 aq-mode: 1 bframes: 4 keyint: 202 keyint_min: 100 ref: 8 audioEncode: type: AudioEncode codec: aac bitrate: 256k suffix: STEREO ``` -------------------------------- ### Get Queues Source: https://svt.github.io/encore-doc/openapi.html Returns a list of queues, where each item is a QueueItem. ```APIDOC ## GET /queue ### Description Returns a list of queues (QueueItems) ### Method GET ### Endpoint /queue ### Responses #### Success Response (200) - **< QueueItem > array** - OK ### Produces - `application/hal+json` ``` -------------------------------- ### Configure Encore Application Properties Source: https://svt.github.io/encore-doc/index.html Customize Encore application behavior by setting properties in application.properties, application.yml, or via command line. This example shows how to configure various settings including temporary encoding, audio mix presets, concurrency, polling, Redis, security, and OpenAPI. ```yaml spring: jackson: time-zone: Europe/Stockholm profile: location: url:http://YOURPROFILESERVERURL/encore/prod/master/profiles.yml encore-settings: local-temporary-encode: true audio-mix-presets: default: fallback-to-auto: false default-pan: 2: stereo| c0 = c0 + 0.707*c2 + 0.707*c4 | c1 = c1 + 0.707*c2 + 0.707*c5 pan-mapping: 6: 2: stereo|c0=1.0*c0+0.707*c2+0.707*c4|c1=1.0*c1+0.707*c2+0.707*c5 de: fallback-to-auto: false pan-mapping: 6: 2: stereo|c0<0.25*c0+1.5*c2+0.25*c4|c1<0.25*c1+1.5*c2+0.25*c5 redis: subscription-connection-pool-size: 25 connection-pool-size: 32 connection-minimum-idle-size: 5 uri: redis://YOURINSTANCE:6379 db: 1 ``` -------------------------------- ### Sign Commits with GPG Key Source: https://svt.github.io/encore-doc/index.html Optionally, use the -S flag along with -s to sign your commits with a GPG key, which displays a verified button on GitHub. Requires GPG key setup. ```bash $ git commit -s -S -m "add fix for the bug" ``` -------------------------------- ### Get EncoreJobs Source: https://svt.github.io/encore-doc/openapi.html Retrieves a collection of EncoreJobs. Supports pagination and sorting. ```APIDOC ## GET /encoreJobs ### Description get-encorejob ### Method GET ### Endpoint /encoreJobs ### Parameters #### Query Parameters - **page** (integer) - Optional - Zero-based page index (0..N). Default: `0` - **size** (integer) - Optional - The size of the page to be returned. Default: `20` - **sort** (< string > array(multi)) - Optional - Sorting criteria in the format: property(,asc|desc). Default sort order is ascending. Multiple sort criteria are supported. ### Responses #### Success Response (200) - **collectionModelEntityModelEncoreJob** (CollectionModelEntityModelEncoreJob) - OK ### Produces - `application/hal+json` - `text/uri-list` - `application/x-spring-data-compact+json` ``` -------------------------------- ### FFmpeg Encore Formula for Homebrew Source: https://svt.github.io/encore-doc/index.html This Ruby script defines a Homebrew formula for FFmpeg, incorporating custom build options and dependencies. It's designed for use with Homebrew AVTools and includes specific configurations for features like ffplay and various codecs. Ensure you have the necessary build tools and dependencies installed. ```ruby # SPDX-FileCopyrightText: 2009-present, Homebrew contributors # SPDX-FileCopyrightText: 2021 Sveriges Television AB # # SPDX-License-Identifier: BSD-2-Clause class FfmpegEncore < Formula desc "Play, record, convert, and stream audio and video" homepage "https://ffmpeg.org/" url "https://ffmpeg.org/releases/ffmpeg-4.3.1.tar.xz" sha256 "ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb" license "GPL-3.0-or-later" revision 1 head "https://github.com/FFmpeg/FFmpeg.git" option "with-ffplay", "Enable ffplay" depends_on "nasm" => :build depends_on "pkg-config" => :build depends_on "aom" depends_on "fdk-aac" => :recommended depends_on "fontconfig" depends_on "freetype" depends_on "lame" depends_on "libass" depends_on "libsoxr" depends_on "libssh" depends_on "libvmaf" depends_on "libvorbis" depends_on "libvpx" depends_on "openssl@3" depends_on "x264-encore" depends_on "x265-encore" uses_from_macos "bzip2" uses_from_macos "zlib" conflicts_with "ffmpeg", because: "it also ships with ffmpeg binary" resource "proxy_filter" do url "https://github.com/SVT/ffmpeg-filter-proxy/archive/v1.0.tar.gz" sha256 "9a9ddfe248ea299ffa5bf9643bed95913f00b3a9d4e03f402aebc3224e4f82f3" end if build.with? "ffplay" depends_on "libxv" unless OS.mac? depends_on "sdl2" end def install args = %W[ --prefix=#{prefix} --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=#{ENV.cc} --host-cflags=#{ENV.cflags} --host-ldflags=#{ENV.ldflags} --enable-gpl --enable-libaom --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-lzma --enable-libass --enable-libfontconfig --enable-libfreetype --disable-libjack --disable-indev=jack --enable-libaom --enable-openssl --enable-libssh --enable-libvmaf --enable-nonfree ] if !build.without? "fdk-aac" args << "--enable-libfdk-aac" end args << "--enable-ffplay" if build.with? "ffplay" args << "--enable-videotoolbox" if OS.mac? # GPL-incompatible libraries, requires ffmpeg to build with "--enable-nonfree" flag, (unredistributable libraries) # Openssl IS GPL compatible since 3, but due to this patch # https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200609001340.52369-1-rcombs@rcombs.me/ # not being in this version we build from, we have to enable non-free anyway. # When FFmpeg base is upgraded (including that patch), we should only enable-nonfree when # fdk-aac is enabled (the default option) # args << "--enable-nonfree" if !build.without?("fdk-aac") resource("proxy_filter").stage do |stage| @proxyfilterpath = Dir.pwd stage.staging.retain! end cp_r Dir.glob("#{@proxyfilterpath}/*.c"), "libavfilter", verbose: true inreplace "libavfilter/allfilters.c", "extern AVFilter ff_vf_yadif;", "extern AVFilter ff_vf_yadif;\nextern AVFilter ff_vf_proxy;\n" inreplace "libavfilter/Makefile", "# video filters", "# video filters\nOBJS-$(CONFIG_PROXY_FILTER) += vf_proxy.o\n" system "./configure", *args system "make", "install" # Build and install additional FFmpeg tools system "make", "alltools" bin.install Dir["tools/*"].select { |f| File.executable? f } # Fix for Non-executables that were installed to bin/ mv bin("python"), pkgshare("python"), force: true end test do # Create an example mp4 file mp4out = testpath("video.mp4") system bin("ffmpeg"), "-filter_complex", "testsrc=rate=1:duration=1", mp4out assert_predicate mp4out, :exist? end end ``` -------------------------------- ### Getting Docker Compose Network IP on Linux Source: https://svt.github.io/encore-doc/index.html Inspect the Docker Compose network to find the IP address used by Encore, necessary for accessing its API. Replace with the directory name where you are running Docker Compose. ```bash $ docker inspect _encorenet ``` -------------------------------- ### Get EncoreJob by ID Source: https://svt.github.io/encore-doc/openapi.html Retrieves a specific EncoreJob using its unique ID. ```APIDOC ## GET /encoreJobs/{id} ### Description get-encorejob ### Method GET ### Endpoint /encoreJobs/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the EncoreJob. ### Responses #### Success Response (200) - **entityModelEncoreJob** (EntityModelEncoreJob) - OK #### Error Response (404) - **No Content** - Not Found ### Produces - `application/hal+json` ``` -------------------------------- ### Building and Running Encore Docker Image Source: https://svt.github.io/encore-doc/index.html Commands to build a Docker image for Encore using a custom FFmpeg base image and then run it. This includes setting environment variables and mounting volumes for input/output. ```bash foobar@foo:~$ docker build -t encore-docker --build-arg DOCKER_BASE_IMAGE= . foobar@foo:~$ docker run --network=host -v /tmp/input:/tmp/input -v /tmp/output:/tmp/output -e SPRING_PROFILES_ACTIVE='local' encore-docker ``` -------------------------------- ### Copy Test Video to Input Directory Source: https://svt.github.io/encore-doc/index.html Copy a test video file to the input directory for processing. Ensure write permissions. ```bash $ cp src/test/resources/input/test.mp4 /tmp/input ``` -------------------------------- ### Build Encore Project Source: https://svt.github.io/encore-doc/index.html Build the Encore project including all tests. Requires JDK 11+ and a Redis instance. ```bash $ ./gradlew clean build ``` -------------------------------- ### Generate OpenAPI Docs with Gradle Source: https://svt.github.io/encore-doc/index.html Run this Gradle task to generate OpenAPI documentation. The output is saved to build/openapi.json. Ensure SPRING_PROFILES_ACTIVE is set to local. ```bash $ SPRING_PROFILES_ACTIVE=local ./gradlew clean generateOpenApiDocs ``` -------------------------------- ### Build Encore Project (Exclude Tests) Source: https://svt.github.io/encore-doc/index.html Build the Encore project, excluding tests. Requires JDK 11+ and a Redis instance. ```bash $ ./gradlew clean build -x test ``` -------------------------------- ### Run Encore as a Runnable Jar Source: https://svt.github.io/encore-doc/index.html Run Encore locally using a developer application profile. Ensure Redis is available. ```bash foobar@foo:~$ SPRING_PROFILES_ACTIVE=local java -jar encore-x.y.z.jar ``` -------------------------------- ### Running Encore with Spring Boot Source: https://svt.github.io/encore-doc/index.html This command runs Encore locally using the Spring Boot Gradle plugin. It activates the 'local' profile, which typically uses `src/main/resources/application-local.yml` for configuration. ```bash foobar@foo:~$ SPRING_PROFILES_ACTIVE=local ./gradlew clean bootRun ``` -------------------------------- ### Post Encore Job via Swagger UI Source: https://svt.github.io/encore-doc/index.html Submit an EncoreJob using the Swagger UI. Replace outputFolder and uri with your specific paths and filename. ```json { "profile": "program", "outputFolder": "/tmp/output", "baseName": "quicktest_", "inputs": [{ "uri": "/tmp/input/test.mp4", "useFirstAudioStreams": 2, "type": "AudioVideo" }] } ``` -------------------------------- ### Docker Compose Configuration for Encore Source: https://svt.github.io/encore-doc/index.html This Docker Compose file sets up Redis and Encore services, defining networks and volume mappings for input and output. ```yaml version: "3.7" services: redis: image: redis:alpine networks: - encorenet encore: image: ghcr.io/svt/encore-debian:latest depends_on: - redis environment: - SPRING_PROFILES_ACTIVE=local - SPRING_REDIS_HOST=redis - PROFILE_LOCATION=url:https://raw.githubusercontent.com/svt/encore-doc/main/src/docs/asciidoc/examples/profile/profiles.yml ports: - "8080:8080" volumes: - /tmp/input:/tmp/input:rw # where your put your source files - /tmp/output:/tmp/output:rw #put your output here networks: - encorenet networks: encorenet: driver: bridge ``` -------------------------------- ### Create EncoreJob Source: https://svt.github.io/encore-doc/openapi.html Creates a new EncoreJob. The request body is optional. ```APIDOC ## POST /encoreJobs ### Description create-encorejob ### Method POST ### Endpoint /encoreJobs ### Parameters #### Request Body - **body** (EncoreJob) - Optional - The EncoreJob object to create. ### Responses #### Success Response (201) - **entityModelEncoreJob** (EntityModelEncoreJob) - Created ### Consumes - `application/json` ### Produces - `application/hal+json` ``` -------------------------------- ### EntityModelEncoreJob Source: https://svt.github.io/encore-doc/openapi.html Represents an Encore Job, which is a task for processing video files. It includes details about the input, output, progress, and various processing options. ```APIDOC ## EntityModelEncoreJob ### Description Represents an Encore Job, which is a task for processing video files. It includes details about the input, output, progress, and various processing options. ### Properties - **_links** (Links) - Optional - Links related to the Encore Job. - **completedDate** (string (date-time)) - Optional, Read-only - The time when the Encore Job was completed (failed or succeeded). - **createdDate** (string (date-time)) - Optional, Read-only - The creation date of the Encore Job. - **cropTo** (string) - Optional - Crop output video to the given aspect ratio. Pattern: `^[1-9]\d*[:/][1-9]\d*$`. Example: `"1:1"`. - **dar** (string) - Optional - The Display Aspect Ratio to use if the input is anamorphic. Overrides DAR found from input metadata. Pattern: `^[1-9]\d*[:/][1-9]\d*$`. Example: `"16:9"`. - **debugOverlay** (boolean) - Optional - Instruct Encore to overlay encoding metadata on the encoded video stream. Default: `false`. - **endTime** (integer (int32)) - Optional - Seek in video stream to the given end time in ms (start time must currently be given). Example: `20000`. - **externalId** (string) - Optional - External ID for backreferencing. Example: `"any-string"`. - **filename** (string) - Optional - The input file that the Encore Job should process. Example: `"/path/to/a/file/file.mxf"`. - **globalAudioFilters** (< string > array) - Optional - List of FFmpeg filters to apply to all audio outputs. Example: `"to-do"`. - **globalVideoFilters** (< string > array) - Optional - List of FFmpeg filters to apply to all video outputs. Example: `"proxy=filter_path=/ffmpeg-filters/libsvg_filter.so:config='svg=/path/logo-white.svg"`. - **id** (string (uuid)) - Optional, Read-only - The internal Encore Job Identity. Example: `"fb2baa17-8972-451b-bb1e-1bc773283476"`. - **input** (VideoFile) - Optional - The input video file details. - **logContext** (< string, string > map) - Optional - Key/Values to append to the MDC log context. - **message** (string) - Optional, Read-only - The exception message, if the Encore Job failed. Example: `"input/output error"`. - **output** (< MediaFile > array) - Optional, Read-only - Analyzed models of the output files. - **outputFolder** (string) - Optional - A directory path to where the output should be written. Example: `"/an/output/path/dir"`. - **padTo** (string) - Optional - Pad output video to the given aspect ratio. Pattern: `^[1-9]\d*[:/][1-9]\d*$`. Example: `"16:9"`. - **priority** (integer (int32)) - Optional - The queue priority of the Encore Job. Default: `0`. Minimum: `0`. Maximum: `100`. - **profile** (string) - Optional - The name of the encoding profile to use. Example: `"x264-animated"`. - **progress** (integer (int32)) - Optional, Read-only - The Encore Job progress. Default: `0`. Example: `57`. - **progressCallbackUri** (string (uri)) - Optional - An URL to which the progress status callback should be directed. Example: `"http://projectx/encorecallback"`. - **speed** (number (double)) - Optional, Read-only - The encoding speed of the job (compared to its play speed/input duration). Example: `0.334`. - **startTime** (integer (int32)) - Optional - Seek in video stream to the given start time in ms (end time must currently be given). Example: `10000`. - **startedDate** (string (date-time)) - Optional, Read-only - The time when the Encore Job was picked from the queue. - **status** (enum (NEW, QUEUED, IN_PROGRESS, SUCCESSFUL, FAILED, CANCELLED)) - Optional, Read-only - The Job Status. - **thumbnailTime** (integer (int32)) - Optional - Time in ms for when the thumbnail should be picked. Overrides profile configuration for thumbnails. Example: `5000`. - **useFirstAudioStreams** (integer (int32)) - Optional - Only the audio input streams up to the given value. Example: `2`. ``` -------------------------------- ### Encore Job Class Definition Source: https://svt.github.io/encore-doc/index.html Defines the Encore Job class with properties for thumbnail time, inputs, output, and status. The status setter automatically updates completedDate and startedDate based on the status transitions. ```kotlin class Job( val id: String, val baseName: String, val externalId: String? = null, val profile: String, val logContext: Map = emptyMap(), @field:Description( description = "Time in seconds for when the thumbnail should be picked. Overrides profile configuration for thumbnails", example = "1800.5", nullable = true ) @Positive val thumbnailTime: Double? = null, @NotEmpty val inputs: List = emptyList() ) { @Schema( description = "Analyzed models of the output files", accessMode = Schema.AccessMode.READ_ONLY ) var output = emptyList() @Schema( description = "The Job Status", accessMode = Schema.AccessMode.READ_ONLY ) @Indexed var status = Status.NEW set(value) { field = value if (value.isCompleted) { completedDate = OffsetDateTime.now() } if (value == Status.IN_PROGRESS) { startedDate = OffsetDateTime.now() } } val contextMap: Map @JsonIgnore get() = mapOf( "id" to id.toString(), "file" to baseName, "externalId" to (externalId ?: ""), "profile" to profile ) + logContext } ``` ``` -------------------------------- ### ImageFile Source: https://svt.github.io/encore-doc/openapi.html Represents an image file, with properties like file name, size, format, and dimensions. ```APIDOC ## ImageFile ### Description Represents an image file, with properties like file name, size, format, and dimensions. ### Polymorphism Inheritance, Discriminator: `type` ### Properties - **file** (string) - Required - The name of the file. - **fileSize** (integer (int64)) - Required - The size of the file in bytes. - **format** (string) - Required - The format of the image file (e.g., JPEG, PNG). - **height** (integer (int32)) - Optional - The height of the image in pixels. - **type** (string) - Required - The type of the file, used for polymorphism. - **width** (integer (int32)) - Optional - The width of the image in pixels. ``` -------------------------------- ### AudioStream Schema Source: https://svt.github.io/encore-doc/openapi.html Defines the structure for audio stream properties. ```APIDOC ## AudioStream ### Description Represents properties of an audio stream. ### Properties - **bitrate** (integer, int64, optional): The bitrate of the audio stream. - **channels** (integer, int32, required): The number of audio channels. - **codec** (string, optional): The audio codec. - **duration** (number, double, optional): The duration of the audio stream. - **format** (string, optional): The audio format. - **samplingRate** (integer, int32, optional): The audio sampling rate. ``` -------------------------------- ### x264 Codec Profile with Forced Keyframes Source: https://svt.github.io/encore-doc/index.html Defines a profile for x264 encoding with specific parameters for multiple resolutions, including forced keyframes and audio encoding. ```yaml name: program description: Program profile scaling: bicubic encodes: - type: X264Encode suffix: 3100 twoPass: true height: 1080 params: b:v: 3100k maxrate: 4700k bufsize: 6200k r: 25 vsync: 1 pix_fmt: yuv420p force_key_frames: expr:not(mod(n,96)) profile:v: high level: 4.1 x264-params: deblock: 0,0 aq-mode: 1 bframes: 6 keyint: 192 keyint_min: 96 ref: 4 audioEncode: type: AudioEncode codec: aac bitrate: 192k suffix: STEREO - type: X264Encode suffix: 2069 twoPass: true height: 720 params: b:v: 2069k maxrate: 3104k bufsize: 4138k r: 25 vsync: 1 pix_fmt: yuv420p force_key_frames: expr:not(mod(n,96)) profile:v: main level: 3.1 x264-params: deblock: 0,0 aq-mode: 1 bframes: 6 keyint: 192 keyint_min: 96 ref: 4 audioEncode: type: AudioEncode codec: aac bitrate: 128k suffix: STEREO - type: X264Encode suffix: 1312 twoPass: true height: 540 params: b:v: 1312k maxrate: 1968k bufsize: 2524k r: 25 vsync: 1 pix_fmt: yuv420p force_key_frames: expr:not(mod(n,96)) level: 3.1 profile:v: main x264-params: deblock: 0,0 aq-mode: 1 bframes: 6 keyint: 192 keyint_min: 96 ref: 4 audioEncode: type: AudioEncode codec: aac bitrate: 96k suffix: STEREO - type: X264Encode suffix: 806 twoPass: true height: 360 params: b:v: 806121 maxrate: 1209182 bufsize: 1612242 r: 25 vsync: 1 pix_fmt: yuv420p force_key_frames: expr:not(mod(n,96)) profile:v: main level: 3.1 x264-params: deblock: 0,0 aq-mode: 1 bframes: 6 keyint: 192 keyint_min: 96 ref: 4 audioEncode: type: AudioEncode codec: aac bitrate: 96k suffix: STEREO - type: X264Encode suffix: 320 twoPass: true height: 234 params: b:v: 324051 maxrate: 486077 bufsize: 648102 r: 25 vsync: 1 pix_fmt: yuv420p force_key_frames: expr:not(mod(n,96)) profile:v: baseline level: 3.1 x264-params: deblock: 0,0 aq-mode: 1 keyint: 192 keyint_min: 96 ref: 3 audioEncode: type: AudioEncode codec: aac bitrate: 96k suffix: STEREO - type: AudioEncode codec: aac bitrate: 192k suffix: STEREO params: cutoff: 20000 - type: AudioEncode codec: aac bitrate: 64k suffix: STEREO_LB params: cutoff: 14000 - type: ThumbnailMapEncode - type: ThumbnailEncode ``` -------------------------------- ### EncoreJob Schema Source: https://svt.github.io/encore-doc/openapi.html Defines the structure and properties of an EncoreJob object. ```APIDOC ## EncoreJob ### Description Represents an encoding job to be processed by Encore. ### Properties - **completedDate** (string, date-time, optional, read-only): The time for when the EncoreJob was completed (fail or success). - **createdDate** (string, date-time, required, read-only): The Creation date for the EncoreJob. - **cropTo** (string, optional): Crop output video to given aspect ratio. Pattern: "^[1-9]\d*[:/][1-9]\d*$". - **dar** (string, optional): The Display Aspect Ratio to use if the input is anamorphic. Overrides DAR found from input metadata (for corrupt video metadata). Pattern: "^[1-9]\d*[:/][1-9]\d*$". - **debugOverlay** (boolean, required, default: false): Instruct Encore to overlay encoding metadata on the encoded video stream. - **endTime** (integer, int32, optional): Seek in video stream to given end time in ms (start time must currently be given). - **externalId** (string, optional): External id - for external backreference. - **filename** (string, required): The input file that the EncoreJob should process. - **globalAudioFilters** (array of strings, required): List of FFmpeg filters to apply to all audio outputs. - **globalVideoFilters** (array of strings, required): List of FFmpeg filters to apply to all video outputs. - **id** (string, uuid, required, read-only): The Encore Internal EncoreJob Identity. - **input** (object, optional): Represents the input video file details. - **logContext** (map of strings, required): Key/Values to append to the MDC log context. - **message** (string, optional, read-only): The exception message, if the EncoreJob failed. - **output** (array of objects, required, read-only): Analyzed models of the output files. - **outputFolder** (string, required): A directory path to where the output should be written. - **padTo** (string, optional): Pad output video to given aspect ratio. Pattern: "^[1-9]\d*[:/][1-9]\d*$". - **priority** (integer, int32, required, default: 0, min: 0, max: 100): The queue priority of the EncoreJob. - **profile** (string, required): The name of the encoding profile to use. - **progress** (integer, int32, required, default: 0, read-only): The EncoreJob progress. - **progressCallbackUri** (string, uri, optional): An url to which the progress status callback should be directed. - **speed** (number, double, optional, read-only): The Encoding speed of the job (compared to it’s play speed/input duration). - **startTime** (integer, int32, optional): Seek in video stream to given start time in ms (end time must currently be given). - **startedDate** (string, date-time, optional, read-only): The time for when the EncoreJob was picked from the queue). - **status** (enum, required, read-only): The Job Status (NEW, QUEUED, IN_PROGRESS, SUCCESSFUL, FAILED, CANCELLED). - **thumbnailTime** (integer, int32, optional): Time in ms for when the thumbnail should be picked. Overrides profile configuration for thumbnails. - **useFirstAudioStreams** (integer, int32, optional): Only the audio input streams up to the given value. ``` -------------------------------- ### CollectionModelEntityModelEncoreJob Schema Source: https://svt.github.io/encore-doc/openapi.html Represents a collection of EncoreJob entities. ```APIDOC ## CollectionModelEntityModelEncoreJob ### Description Represents a collection of EncoreJob entities, typically returned in a paginated response. ### Properties - **_embedded** (object, optional): Contains the actual list of EncoreJob entities. - **_links** (object, optional): Contains links for pagination and related resources. ``` -------------------------------- ### Link Source: https://svt.github.io/encore-doc/openapi.html Represents a link, typically used in hypermedia APIs, with various attributes to describe the link's purpose and target. ```APIDOC ## Link ### Description Represents a link, typically used in hypermedia APIs, with various attributes to describe the link's purpose and target. ### Properties - **deprecation** (string) - Optional - Indicates if the link is deprecated. - **href** (string) - Optional - The URL of the link. - **hreflang** (string) - Optional - The language of the linked resource. - **name** (string) - Optional - The name of the link. - **profile** (string) - Optional - A URI that identifies a profile of the linked resource. - **templated** (boolean) - Optional - Indicates if the href is a URI template. - **title** (string) - Optional - The title of the link. - **type** (string) - Optional - The media type of the linked resource. ``` -------------------------------- ### Links Source: https://svt.github.io/encore-doc/openapi.html A map where keys are link relation types and values are Link objects. ```APIDOC ## Links ### Description A map where keys are link relation types and values are Link objects. ### Type < string, Link > map ``` -------------------------------- ### Find EncoreJobs By Status Source: https://svt.github.io/encore-doc/openapi.html Returns EncoreJobs filtered by their status. Supports pagination and sorting. ```APIDOC ## GET /encoreJobs/search/findByStatus ### Description Returns EncoreJobs according to the given Status ### Method GET ### Endpoint /encoreJobs/search/findByStatus ### Parameters #### Query Parameters - **page** (integer) - Optional - Zero-based page index (0..N). Default: `0` - **size** (integer) - Optional - The size of the page to be returned. Default: `20` - **sort** (< string > array(multi)) - Optional - Sorting criteria in the format: property(,asc|desc). Default sort order is ascending. Multiple sort criteria are supported. - **status** (enum (NEW, QUEUED, IN_PROGRESS, SUCCESSFUL, FAILED, CANCELLED)) - Optional - The status to filter EncoreJobs by. ### Responses #### Success Response (200) - **pagedModelEncoreJob** (PagedModelEncoreJob) - OK #### Error Response (404) - **No Content** - Not Found ### Produces - `application/hal+json` ``` -------------------------------- ### Sign Commits with DCO Source: https://svt.github.io/encore-doc/index.html Use the -s flag with git commit to sign off your commits, confirming agreement with the DCO. This is required for pull requests. ```bash $ git commit -s -m "add fix for the bug" ``` -------------------------------- ### EncoreJob Data Class Definition in Kotlin Source: https://svt.github.io/encore-doc/index.html Defines the EncoreJob data class in Kotlin, including its fields, annotations for Redis and Swagger, and validation constraints. Use this class to represent and manage encoding jobs within the Encore system. ```kotlin // SPDX-FileCopyrightText: 2020 Sveriges Television AB // // SPDX-License-Identifier: EUPL-1.2 package se.svt.oss.encore.model import com.fasterxml.jackson.annotation.JsonIgnore import io.swagger.v3.oas.annotations.media.Schema import io.swagger.v3.oas.annotations.tags.Tag import org.springframework.data.annotation.Id import org.springframework.data.redis.core.RedisHash import org.springframework.data.redis.core.index.Indexed import org.springframework.validation.annotation.Validated import se.svt.oss.encore.model.input.Input import se.svt.oss.mediaanalyzer.file.MediaFile import java.net.URI import java.time.OffsetDateTime import java.util.UUID import javax.validation.constraints.Max import javax.validation.constraints.Min import javax.validation.constraints.NotBlank import javax.validation.constraints.NotEmpty import javax.validation.constraints.Positive @Validated @RedisHash("encore-jobs", timeToLive = (60 * 60 * 24 * 7).toLong()) // 1 week ttl @Tag(name = "encorejob") data class EncoreJob( @Schema( description = "The Encore Internal EncoreJob Identity", example = "fb2baa17-8972-451b-bb1e-1bc773283476", accessMode = Schema.AccessMode.READ_ONLY, hidden = false, defaultValue = "A random UUID" ) @Id val id: UUID = UUID.randomUUID(), @Schema( description = "External id - for external backreference", example = "any-string", nullable = true ) val externalId: String? = null, @Schema( description = "The name of the encoding profile to use", example = "x264-animated", required = true ) @NotBlank val profile: String, @Schema( description = "A directory path to where the output should be written", example = "/an/output/path/dir", required = true ) @NotBlank val outputFolder: String, @Schema( description = "Base filename of output files", example = "any_file", required = true ) @NotBlank val baseName: String, @Schema( description = "The Creation date for the EncoreJob", example = "2021-04-22T03:00:48.759168+02:00", accessMode = Schema.AccessMode.READ_ONLY, defaultValue = "now()" ) @Indexed val createdDate: OffsetDateTime = OffsetDateTime.now(), @Schema( description = "An url to which the progress status callback should be directed", example = "http://projectx/encorecallback", nullable = true ) val progressCallbackUri: URI? = null, @Schema( description = "The queue priority of the EncoreJob", defaultValue = "0", minimum = "0", maximum = "100" ) @Min(0) @Max(100) val priority: Int = 0, @Schema( description = "The exception message, if the EncoreJob failed", example = "input/output error", accessMode = Schema.AccessMode.READ_ONLY, nullable = true ) var message: String? = null, @Schema( description = "The EncoreJob progress", example = "57", accessMode = Schema.AccessMode.READ_ONLY, defaultValue = "0" ) var progress: Int = 0, @Schema( description = "The Encoding speed of the job (compared to it's play speed/input duration)", example = "0.334", accessMode = Schema.AccessMode.READ_ONLY, nullable = true ) var speed: Double? = null, @Schema( description = "The time for when the EncoreJob was picked from the queue)", example = "2021-04-19T07:20:43.819141+02:00", accessMode = Schema.AccessMode.READ_ONLY, nullable = true ) var startedDate: OffsetDateTime? = null, @Schema( description = "The time for when the EncoreJob was completed (fail or success)", example = "2021-04-19T07:20:43.819141+02:00", accessMode = Schema.AccessMode.READ_ONLY, nullable = true ) var completedDate: OffsetDateTime? = null, @Schema( description = "Instruct Encore to overlay encoding metadata on the encoded video stream", defaultValue = "false" ) val debugOverlay: Boolean = false, @Schema(description = "Key/Values to append to the MDC log context", defaultValue = "{}") val logContext: Map = emptyMap(), @Schema(description = "Seek to given time in seconds before encoding output.", nullable = true, example = "60.0") val seekTo: Double? = null, @Schema(description = "Limit output to given duration.", nullable = true, example = "60.0") val duration: Double? = null, @Schema( ``` -------------------------------- ### Update EncoreJob Source: https://svt.github.io/encore-doc/openapi.html Updates an existing EncoreJob identified by its ID. The request body is optional. ```APIDOC ## PUT /encoreJobs/{id} ### Description update-encorejob ### Method PUT ### Endpoint /encoreJobs/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the EncoreJob to update. #### Request Body - **body** (EncoreJob) - Optional - The updated EncoreJob object. ### Responses #### Success Response (200) - **entityModelEncoreJob** (EntityModelEncoreJob) - OK #### Success Response (201) - **entityModelEncoreJob** (EntityModelEncoreJob) - Created #### Success Response (204) - **No Content** - No Content ### Consumes - `application/json` ### Produces - `application/hal+json` ``` -------------------------------- ### Patch EncoreJob Source: https://svt.github.io/encore-doc/openapi.html Partially updates an existing EncoreJob identified by its ID. The request body is optional. ```APIDOC ## PATCH /encoreJobs/{id} ### Description patch-encorejob ### Method PATCH ### Endpoint /encoreJobs/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the EncoreJob to patch. #### Request Body - **body** (EncoreJob) - Optional - The EncoreJob object with partial updates. ### Responses #### Success Response (200) - **entityModelEncoreJob** (EntityModelEncoreJob) - OK #### Success Response (204) - **No Content** - No Content ### Consumes - `application/json` ### Produces - `application/hal+json` ``` -------------------------------- ### Define Encore Job Status Enum in Kotlin Source: https://svt.github.io/encore-doc/index.html This enum represents the possible statuses of an Encore Job throughout its workflow. It includes properties to check if a status is completed or cancelled. ```kotlin // SPDX-FileCopyrightText: 2020 Sveriges Television AB // // SPDX-License-Identifier: EUPL-1.2 package se.svt.oss.encore.model enum class Status(val isCompleted: Boolean) { NEW(false), QUEUED(false), IN_PROGRESS(false), SUCCESSFUL(true), FAILED(true), CANCELLED(true); val isCancelled: Boolean get() = this == CANCELLED } ``` -------------------------------- ### Delete EncoreJob Source: https://svt.github.io/encore-doc/openapi.html Deletes a specific EncoreJob using its unique ID. ```APIDOC ## DELETE /encoreJobs/{id} ### Description delete-encorejob ### Method DELETE ### Endpoint /encoreJobs/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the EncoreJob to delete. ### Responses #### Success Response (204) - **No Content** - No Content #### Error Response (404) - **No Content** - Not Found ### Tags - encorejob ``` -------------------------------- ### Cancel EncoreJob Source: https://svt.github.io/encore-doc/openapi.html Cancels an EncoreJob with the given JobId. ```APIDOC ## POST /encoreJobs/{jobId}/cancel ### Description Cancels an EncoreJob with the given JobId ### Method POST ### Endpoint /encoreJobs/{jobId}/cancel ### Parameters #### Path Parameters - **jobId** (string (uuid)) - Required - The unique identifier of the job to cancel. ### Responses #### Success Response (200) - **string** - OK ### Produces - `application/hal+json` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.