Package org.opencastproject.composer.api
Interface ComposerService
- All Known Implementing Classes:
ComposerServiceImpl,ComposerServiceRemoteImpl
public interface ComposerService
Encodes media and (optionally) periodically alerts a statusService endpoint of the status of this encoding job.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringUsed as mediaType to mark the source to omit processing of audio or video stream for process smilstatic final Stringstatic final Stringstatic final Stringstatic final StringsourceAudioName options for composite - use one or both, if null is passed, both will be usedstatic final String -
Method Summary
Modifier and TypeMethodDescriptioncomposite(Dimension outputDimension, Option<LaidOutElement<Track>> option, LaidOutElement<Track> lowerLaidOutElement, Option<LaidOutElement<Attachment>> watermarkOption, String identifier, String outputBackground, String sourceAudioName) Compose two videos into one with an optional watermark.Concat multiple tracks to a single track.concat(String profileId, Dimension outputDimension, float outputFrameRate, boolean sameCodec, Track... tracks) Concat multiple tracks to a single track.convertImage(Attachment image, String... profileIds) Converts the given image to a different image format using the specified image profiles.convertImageSync(Attachment image, String... profileIds) Synchronously converts the given image to different image formats using the specified encoding profiles.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/workEncode one track, using that track's audio and video streams.getProfile(String profileId) Gets a profile by its IDExtracts an image from the media package element identified bysourceVideoTrackId.Extracts an image from the media package element identified bysourceTrack.Synchronously extracts images from the source track.imageToVideo(Attachment sourceImageAttachment, String profileId, double duration) Transforms an image attachment to a video trackmultiEncode(Track track, List<String> profileIds) Encodes a track to set of media targets as defined by a list of encoding profilesMux multiple tracks into a new Track.Encode the video stream from one track and the audio stream from another, into a new Track.parallelEncode(Track sourceTrack, String profileId) Encode one track to multiple other tracks in one encoding operation, using that track's audio and video streams.Reads a smil definition and create one media track in multiple delivery formats.Trims the given track to the given start time and duration.
-
Field Details
-
JOB_TYPE
- See Also:
-
AUDIO_ONLY
Used as mediaType to mark the source to omit processing of audio or video stream for process smil- See Also:
-
VIDEO_ONLY
- See Also:
-
UPPER
sourceAudioName options for composite - use one or both, if null is passed, both will be used- See Also:
-
LOWER
- See Also:
-
BOTH
- See Also:
-
-
Method Details
-
encode
Encode one track, using that track's audio and video streams.- Parameters:
sourceTrack- The source trackprofileId- 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:
EncoderExceptionMediaPackageException
-
mux
Job mux(Track sourceVideoTrack, Track sourceAudioTrack, String profileId) throws EncoderException, MediaPackageException Encode the video stream from one track and the audio stream from another, into a new Track.- Parameters:
sourceVideoTrack- The source video tracksourceAudioTrack- The source audio trackprofileId- The profile to use for encoding- Returns:
- The receipt for this encoding job
- Throws:
EncoderException- if encoding failsMediaPackageException- if the mediapackage is invalid
-
mux
Job mux(Map<String, Track> sourceTracks, String profileId) throws EncoderException, MediaPackageExceptionMux multiple tracks into a new Track.- Parameters:
sourceTracks- The source tracksprofileId- The profile to use for encoding- Returns:
- The receipt for this encoding job
- Throws:
EncoderException- if encoding failsMediaPackageException- if the mediapackage is invalid
-
composite
Job composite(Dimension outputDimension, Option<LaidOutElement<Track>> option, LaidOutElement<Track> lowerLaidOutElement, Option<LaidOutElement<Attachment>> watermarkOption, String identifier, String outputBackground, String sourceAudioName) throws EncoderException, MediaPackageException Compose two videos into one with an optional watermark.- Parameters:
outputDimension- The composite track dimensionoption- upper track element from mediapackage (optional)lowerLaidOutElement- lower track element from mediapackagewatermarkOption- watermark element (optional)identifier- Encoding profile nameoutputBackground- The background colorsourceAudioName- 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 failsMediaPackageException- if the mediapackage is invalid
-
concat
Job concat(String profileId, Dimension outputDimension, boolean sameCodec, Track... tracks) throws EncoderException, MediaPackageException Concat multiple tracks to a single track.- Parameters:
profileId- The encoding profile to useoutputDimension- The output dimensionssameCodec- Defines if lossless concat should be usedtracks- an array of track to concat in order of the array- Returns:
- The receipt for this concat job
- Throws:
EncoderException- if encoding failsMediaPackageException- if the mediapackage is invalid
-
concat
Job concat(String profileId, Dimension outputDimension, float outputFrameRate, boolean sameCodec, Track... tracks) throws EncoderException, MediaPackageException Concat multiple tracks to a single track. Required ffmpeg version 1.1- Parameters:
profileId- The encoding profile to useoutputDimension- The output dimensionsoutputFrameRate- The output frame ratesameCodec- Defines if lossless concat should be usedtracks- an array of track to concat in order of the array- Returns:
- The receipt for this concat job
- Throws:
EncoderException- if encoding failsMediaPackageException- if the mediapackage is invalid
-
imageToVideo
Job imageToVideo(Attachment sourceImageAttachment, String profileId, double duration) throws EncoderException, MediaPackageException Transforms an image attachment to a video track- Parameters:
sourceImageAttachment- The source image attachmentprofileId- The profile to use for encodingduration- the length of the resulting video track in seconds- Returns:
- The receipt for this image to video job
- Throws:
EncoderException- if encoding failsMediaPackageException- if the mediapackage is invalid
-
trim
Job trim(Track sourceTrack, String profileId, long start, long duration) throws EncoderException, MediaPackageException Trims the given track to the given start time and duration.- Parameters:
sourceTrack- The source trackprofileId- The profile to use for trimmingstart- start time in milisecondsduration- 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 failsMediaPackageException- if the mediapackage is invalid
-
image
Job image(Track sourceTrack, String profileId, double... time) throws EncoderException, MediaPackageException Extracts an image from the media package element identified bysourceVideoTrackId. The image is taken at the timepointtimeseconds into the movie.- Parameters:
sourceTrack- the source video trackprofileId- identifier of the encoding profiletime- number of seconds into the video- Returns:
- the extracted image as an attachment
- Throws:
EncoderException- if image extraction failsMediaPackageException- if the mediapackage is invalid
-
imageSync
List<Attachment> imageSync(Track sourceTrack, String profileId, double... time) throws EncoderException, 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 trackprofileId- identifier of the encoding profiletime- number of seconds into the video- Returns:
- the extracted images as attachments
- Throws:
EncoderException- if image extraction failsMediaPackageException- if the mediapackage is invalid
-
image
Job image(Track sourceTrack, String profileId, Map<String, String> properties) throws EncoderException, MediaPackageExceptionExtracts an image from the media package element identified bysourceTrack. The image is taken by the given properties and the corresponding encoding profile.- Parameters:
sourceTrack- the source video trackprofileId- identifier of the encoding profileproperties- the properties applied to the encoding profile- Returns:
- the extracted image as an attachment
- Throws:
EncoderException- if image extraction failsMediaPackageException- if the mediapackage is invalid
-
convertImage
Job convertImage(Attachment image, String... profileIds) throws EncoderException, MediaPackageException Converts the given image to a different image format using the specified image profiles.- Parameters:
image- the imageprofileIds- the profiles to use for conversion- Returns:
- the job for the image conversion
- Throws:
EncoderException- if image conversion failsMediaPackageException- if the mediapackage is invalid
-
convertImageSync
List<Attachment> convertImageSync(Attachment image, String... profileIds) throws EncoderException, 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 imageprofileIds- the profiles to use for conversion- Returns:
- the converted images
- Throws:
EncoderException- if image conversion failsMediaPackageException- if the mediapackage is invalid
-
listProfiles
EncodingProfile[] listProfiles()- Returns:
- All registered
EncodingProfiles.
-
getProfile
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
Job parallelEncode(Track sourceTrack, String profileId) throws EncoderException, MediaPackageException Encode one track to multiple other tracks in one encoding operation, using that track's audio and video streams.- Parameters:
sourceTrack- The source trackprofileId- The profile to use for encoding- Throws:
EncoderExceptionMediaPackageException
-
demux
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:
EncoderExceptionMediaPackageException
-
processSmil
Job processSmil(Smil smil, String trackParamGroupId, String mediaType, List<String> profileIds) throws EncoderException, 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 transitionstrackParamGroupId- - track group id to process, if missing, will process first track found in smilmediaType- - v for videoOnly, a for audioOnly, anything else is AudioVisualprofileIds- - Encoding profiles for each output from this media- Returns:
- Receipt for this processing based on the smil file and the list of profiles
- Throws:
EncoderExceptionMediaPackageException
-
multiEncode
Job multiEncode(Track track, List<String> profileIds) throws EncoderException, MediaPackageException Encodes a track to set of media targets as defined by a list of encoding profiles- Parameters:
track- - video or audio trackprofileIds- - a list of encoding profiles by name- Returns:
- Receipt for this processing based on the inputs
- Throws:
EncoderException- if it failsMediaPackageException- if adding files to a mediapackage produces errors
-