Interface ComposerService


public interface ComposerService
Encodes media and (optionally) periodically alerts a statusService endpoint of the status of this encoding job.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Used as mediaType to mark the source to omit processing of audio or video stream for process smil
    static final String
     
    static final String
     
    static final String
     
    static final String
    sourceAudioName options for composite - use one or both, if null is passed, both will be used
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.opencastproject.job.api.Job
    composite(Dimension outputDimension, org.opencastproject.util.data.Option<LaidOutElement<org.opencastproject.mediapackage.Track>> option, LaidOutElement<org.opencastproject.mediapackage.Track> lowerLaidOutElement, org.opencastproject.util.data.Option<LaidOutElement<org.opencastproject.mediapackage.Attachment>> watermarkOption, String identifier, String outputBackground, String sourceAudioName)
    Compose two videos into one with an optional watermark.
    org.opencastproject.job.api.Job
    concat(String profileId, Dimension outputDimension, boolean sameCodec, org.opencastproject.mediapackage.Track... tracks)
    Concat multiple tracks to a single track.
    org.opencastproject.job.api.Job
    concat(String profileId, Dimension outputDimension, float outputFrameRate, boolean sameCodec, org.opencastproject.mediapackage.Track... tracks)
    Concat multiple tracks to a single track.
    org.opencastproject.job.api.Job
    convertImage(org.opencastproject.mediapackage.Attachment image, String... profileIds)
    Converts the given image to a different image format using the specified image profiles.
    List<org.opencastproject.mediapackage.Attachment>
    convertImageSync(org.opencastproject.mediapackage.Attachment image, String... profileIds)
    Synchronously converts the given image to different image formats using the specified encoding profiles.
    org.opencastproject.job.api.Job
    demux(org.opencastproject.mediapackage.Track sourceTrack, String profileId)
    Demux a multi-track source into 2 media as defined by the encoding profile, the results are flavored and tagged positionally. eg: One ffmpeg operation to produce presenter/work and presentation/work
    org.opencastproject.job.api.Job
    encode(org.opencastproject.mediapackage.Track sourceTrack, String profileId)
    Encode one track, using that track's audio and video streams.
    getProfile(String profileId)
    Gets a profile by its ID
    org.opencastproject.job.api.Job
    image(org.opencastproject.mediapackage.Track sourceTrack, String profileId, double... time)
    Extracts an image from the media package element identified by sourceVideoTrackId.
    org.opencastproject.job.api.Job
    image(org.opencastproject.mediapackage.Track sourceTrack, String profileId, Map<String,String> properties)
    Extracts an image from the media package element identified by sourceTrack.
    List<org.opencastproject.mediapackage.Attachment>
    imageSync(org.opencastproject.mediapackage.Track sourceTrack, String profileId, double... time)
    Synchronously extracts images from the source track.
    org.opencastproject.job.api.Job
    imageToVideo(org.opencastproject.mediapackage.Attachment sourceImageAttachment, String profileId, double duration)
    Transforms an image attachment to a video track
     
    org.opencastproject.job.api.Job
    multiEncode(org.opencastproject.mediapackage.Track track, List<String> profileIds)
    Encodes a track to set of media targets as defined by a list of encoding profiles
    org.opencastproject.job.api.Job
    mux(Map<String,org.opencastproject.mediapackage.Track> sourceTracks, String profileId)
    Mux multiple tracks into a new Track.
    org.opencastproject.job.api.Job
    mux(org.opencastproject.mediapackage.Track sourceVideoTrack, org.opencastproject.mediapackage.Track sourceAudioTrack, String profileId)
    Encode the video stream from one track and the audio stream from another, into a new Track.
    org.opencastproject.job.api.Job
    parallelEncode(org.opencastproject.mediapackage.Track sourceTrack, String profileId)
    Encode one track to multiple other tracks in one encoding operation, using that track's audio and video streams.
    org.opencastproject.job.api.Job
    processSmil(org.opencastproject.smil.entity.api.Smil smil, String trackParamGroupId, String mediaType, List<String> profileIds)
    Reads a smil definition and create one media track in multiple delivery formats.
    org.opencastproject.job.api.Job
    trim(org.opencastproject.mediapackage.Track sourceTrack, String profileId, long start, long duration)
    Trims the given track to the given start time and duration.
  • Field Details

  • Method Details

    • encode

      org.opencastproject.job.api.Job encode(org.opencastproject.mediapackage.Track sourceTrack, String profileId) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Encode one track, using that track's audio and video streams.
      Parameters:
      sourceTrack - The source track
      profileId - The profile to use for encoding
      Returns:
      The receipt for this encoding job. The receipt can be used with ComposerService#getJob to obtain the status of an encoding job.
      Throws:
      EncoderException
      org.opencastproject.mediapackage.MediaPackageException
    • mux

      org.opencastproject.job.api.Job mux(org.opencastproject.mediapackage.Track sourceVideoTrack, org.opencastproject.mediapackage.Track sourceAudioTrack, String profileId) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Encode the video stream from one track and the audio stream from another, into a new Track.
      Parameters:
      sourceVideoTrack - The source video track
      sourceAudioTrack - The source audio track
      profileId - The profile to use for encoding
      Returns:
      The receipt for this encoding job
      Throws:
      EncoderException - if encoding fails
      org.opencastproject.mediapackage.MediaPackageException - if the mediapackage is invalid
    • mux

      org.opencastproject.job.api.Job mux(Map<String,org.opencastproject.mediapackage.Track> sourceTracks, String profileId) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Mux multiple tracks into a new Track.
      Parameters:
      sourceTracks - The source tracks
      profileId - The profile to use for encoding
      Returns:
      The receipt for this encoding job
      Throws:
      EncoderException - if encoding fails
      org.opencastproject.mediapackage.MediaPackageException - if the mediapackage is invalid
    • composite

      org.opencastproject.job.api.Job composite(Dimension outputDimension, org.opencastproject.util.data.Option<LaidOutElement<org.opencastproject.mediapackage.Track>> option, LaidOutElement<org.opencastproject.mediapackage.Track> lowerLaidOutElement, org.opencastproject.util.data.Option<LaidOutElement<org.opencastproject.mediapackage.Attachment>> watermarkOption, String identifier, String outputBackground, String sourceAudioName) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Compose two videos into one with an optional watermark.
      Parameters:
      outputDimension - The composite track dimension
      option - upper track element from mediapackage (optional)
      lowerLaidOutElement - lower track element from mediapackage
      watermarkOption - watermark element (optional)
      identifier - Encoding profile name
      outputBackground - The background color
      sourceAudioName - Use audio from only lower or upper track or both, use both when available if omitted
      Returns:
      The receipt for this composite job
      Throws:
      EncoderException - if encoding fails
      org.opencastproject.mediapackage.MediaPackageException - if the mediapackage is invalid
    • concat

      org.opencastproject.job.api.Job concat(String profileId, Dimension outputDimension, boolean sameCodec, org.opencastproject.mediapackage.Track... tracks) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Concat multiple tracks to a single track.
      Parameters:
      profileId - The encoding profile to use
      outputDimension - The output dimensions
      sameCodec - Defines if lossless concat should be used
      tracks - an array of track to concat in order of the array
      Returns:
      The receipt for this concat job
      Throws:
      EncoderException - if encoding fails
      org.opencastproject.mediapackage.MediaPackageException - if the mediapackage is invalid
    • concat

      org.opencastproject.job.api.Job concat(String profileId, Dimension outputDimension, float outputFrameRate, boolean sameCodec, org.opencastproject.mediapackage.Track... tracks) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Concat multiple tracks to a single track. Required ffmpeg version 1.1
      Parameters:
      profileId - The encoding profile to use
      outputDimension - The output dimensions
      outputFrameRate - The output frame rate
      sameCodec - Defines if lossless concat should be used
      tracks - an array of track to concat in order of the array
      Returns:
      The receipt for this concat job
      Throws:
      EncoderException - if encoding fails
      org.opencastproject.mediapackage.MediaPackageException - if the mediapackage is invalid
    • imageToVideo

      org.opencastproject.job.api.Job imageToVideo(org.opencastproject.mediapackage.Attachment sourceImageAttachment, String profileId, double duration) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Transforms an image attachment to a video track
      Parameters:
      sourceImageAttachment - The source image attachment
      profileId - The profile to use for encoding
      duration - the length of the resulting video track in seconds
      Returns:
      The receipt for this image to video job
      Throws:
      EncoderException - if encoding fails
      org.opencastproject.mediapackage.MediaPackageException - if the mediapackage is invalid
    • trim

      org.opencastproject.job.api.Job trim(org.opencastproject.mediapackage.Track sourceTrack, String profileId, long start, long duration) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Trims the given track to the given start time and duration.
      Parameters:
      sourceTrack - The source track
      profileId - The profile to use for trimming
      start - start time in miliseconds
      duration - duration in miliseconds
      Returns:
      The receipt for this encoding job. The receipt can be used with ComposerService#getJob to obtain the status of an encoding job.
      Throws:
      EncoderException - if trimming fails
      org.opencastproject.mediapackage.MediaPackageException - if the mediapackage is invalid
    • image

      org.opencastproject.job.api.Job image(org.opencastproject.mediapackage.Track sourceTrack, String profileId, double... time) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Extracts an image from the media package element identified by sourceVideoTrackId. The image is taken at the timepoint time seconds into the movie.
      Parameters:
      sourceTrack - the source video track
      profileId - identifier of the encoding profile
      time - number of seconds into the video
      Returns:
      the extracted image as an attachment
      Throws:
      EncoderException - if image extraction fails
      org.opencastproject.mediapackage.MediaPackageException - if the mediapackage is invalid
    • imageSync

      List<org.opencastproject.mediapackage.Attachment> imageSync(org.opencastproject.mediapackage.Track sourceTrack, String profileId, double... time) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Synchronously extracts images from the source track. The images are taken at the given timepoints (seconds into the movie). Please note that synchronously doing this means, that the workload cannot be distributed amongst all nodes. This should be used rarely.
      Parameters:
      sourceTrack - the source video track
      profileId - identifier of the encoding profile
      time - number of seconds into the video
      Returns:
      the extracted images as attachments
      Throws:
      EncoderException - if image extraction fails
      org.opencastproject.mediapackage.MediaPackageException - if the mediapackage is invalid
    • image

      org.opencastproject.job.api.Job image(org.opencastproject.mediapackage.Track sourceTrack, String profileId, Map<String,String> properties) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Extracts an image from the media package element identified by sourceTrack. The image is taken by the given properties and the corresponding encoding profile.
      Parameters:
      sourceTrack - the source video track
      profileId - identifier of the encoding profile
      properties - the properties applied to the encoding profile
      Returns:
      the extracted image as an attachment
      Throws:
      EncoderException - if image extraction fails
      org.opencastproject.mediapackage.MediaPackageException - if the mediapackage is invalid
    • convertImage

      org.opencastproject.job.api.Job convertImage(org.opencastproject.mediapackage.Attachment image, String... profileIds) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Converts the given image to a different image format using the specified image profiles.
      Parameters:
      image - the image
      profileIds - the profiles to use for conversion
      Returns:
      the job for the image conversion
      Throws:
      EncoderException - if image conversion fails
      org.opencastproject.mediapackage.MediaPackageException - if the mediapackage is invalid
    • convertImageSync

      List<org.opencastproject.mediapackage.Attachment> convertImageSync(org.opencastproject.mediapackage.Attachment image, String... profileIds) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Synchronously converts the given image to different image formats using the specified encoding profiles. Please note that synchronously doing this means that the workload cannot be distributed amongst all nodes.
      Parameters:
      image - the image
      profileIds - the profiles to use for conversion
      Returns:
      the converted images
      Throws:
      EncoderException - if image conversion fails
      org.opencastproject.mediapackage.MediaPackageException - if the mediapackage is invalid
    • listProfiles

      EncodingProfile[] listProfiles()
      Returns:
      All registered EncodingProfiles.
    • getProfile

      EncodingProfile getProfile(String profileId)
      Gets a profile by its ID
      Parameters:
      profileId - The profile ID
      Returns:
      The encoding profile, or null if no profile is registered with that ID
    • parallelEncode

      org.opencastproject.job.api.Job parallelEncode(org.opencastproject.mediapackage.Track sourceTrack, String profileId) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Encode one track to multiple other tracks in one encoding operation, using that track's audio and video streams.
      Parameters:
      sourceTrack - The source track
      profileId - The profile to use for encoding
      Throws:
      EncoderException
      org.opencastproject.mediapackage.MediaPackageException
    • demux

      org.opencastproject.job.api.Job demux(org.opencastproject.mediapackage.Track sourceTrack, String profileId) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Demux a multi-track source into 2 media as defined by the encoding profile, the results are flavored and tagged positionally. eg: One ffmpeg operation to produce presenter/work and presentation/work
      Parameters:
      sourceTrack -
      profileId -
      Returns:
      Receipt for this demux based on the profile
      Throws:
      EncoderException
      org.opencastproject.mediapackage.MediaPackageException
    • processSmil

      org.opencastproject.job.api.Job processSmil(org.opencastproject.smil.entity.api.Smil smil, String trackParamGroupId, String mediaType, List<String> profileIds) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Reads a smil definition and create one media track in multiple delivery formats. The track in the smil is selected by "trackParamGroupId" which is the paramGroup in the smil The multiple delivery formats are determined by a list of encoding profiles by name. The resultant tracks will be tagged by profile name. The smil file can contain more than one source track but they must have the same dimension. This is used mainly on smil.xml from the editor. There is a configurable fadein/fadeout between each clip (default is 2s).
      Parameters:
      smil - - Describes one media (can contain multiple source in ws) and editing instructions (in out points of video clips) for concatenation into one video with transitions
      trackParamGroupId - - track group id to process, if missing, will process first track found in smil
      mediaType - - v for videoOnly, a for audioOnly, anything else is AudioVisual
      profileIds - - Encoding profiles for each output from this media
      Returns:
      Receipt for this processing based on the smil file and the list of profiles
      Throws:
      EncoderException
      org.opencastproject.mediapackage.MediaPackageException
    • multiEncode

      org.opencastproject.job.api.Job multiEncode(org.opencastproject.mediapackage.Track track, List<String> profileIds) throws EncoderException, org.opencastproject.mediapackage.MediaPackageException
      Encodes a track to set of media targets as defined by a list of encoding profiles
      Parameters:
      track - - video or audio track
      profileIds - - a list of encoding profiles by name
      Returns:
      Receipt for this processing based on the inputs
      Throws:
      EncoderException - if it fails
      org.opencastproject.mediapackage.MediaPackageException - if adding files to a mediapackage produces errors