Class ComposerServiceRemoteImpl
java.lang.Object
org.opencastproject.serviceregistry.api.RemoteBase
org.opencastproject.composer.remote.ComposerServiceRemoteImpl
- All Implemented Interfaces:
ComposerService
Proxies a set of remote composer services for use as a JVM-local service. Remote services are selected at random.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opencastproject.serviceregistry.api.RemoteBase
RemoteBase.HttpClientClosingInputStream -
Field Summary
Fields inherited from class org.opencastproject.serviceregistry.api.RemoteBase
client, remoteServiceManager, serviceTypeFields inherited from interface org.opencastproject.composer.api.ComposerService
AUDIO_ONLY, BOTH, JOB_TYPE, LOWER, UPPER, VIDEO_ONLY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildTimeArray(double[] times) Builds string containing times in seconds separated by comma.composite(Dimension compositeTrackSize, Optional<LaidOutElement<Track>> upperTrack, LaidOutElement<Track> lowerTrack, Optional<LaidOutElement<Attachment>> watermark, String profileId, String background, 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 time) Transforms an image attachment to a video trackmultiEncode(Track sourceTrack, 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.voidsetRemoteServiceManager(ServiceRegistry remoteServiceManager) Sets the remote service manager.voidSets the trusted http clientTrims the given track to the given start time and duration.Methods inherited from class org.opencastproject.serviceregistry.api.RemoteBase
closeConnection, elementsFromHttpResponse, getResponse, getResponse, runRequest
-
Constructor Details
-
ComposerServiceRemoteImpl
public ComposerServiceRemoteImpl()
-
-
Method Details
-
setTrustedHttpClient
Sets the trusted http client- Overrides:
setTrustedHttpClientin classRemoteBase- Parameters:
client-
-
setRemoteServiceManager
Sets the remote service manager.- Overrides:
setRemoteServiceManagerin classRemoteBase- Parameters:
remoteServiceManager-
-
encode
Encode one track, using that track's audio and video streams.- Specified by:
encodein interfaceComposerService- 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:
EncoderException- See Also:
-
parallelEncode
Encode one track to multiple other tracks in one encoding operation, using that track's audio and video streams.- Specified by:
parallelEncodein interfaceComposerService- Parameters:
sourceTrack- The source trackprofileId- The profile to use for encoding- Throws:
EncoderException
-
trim
public Job trim(Track sourceTrack, String profileId, long start, long duration) throws EncoderException Trims the given track to the given start time and duration.- Specified by:
trimin interfaceComposerService- 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 fails- See Also:
-
mux
public Job mux(Track sourceVideoTrack, Track sourceAudioTrack, String profileId) throws EncoderException Encode the video stream from one track and the audio stream from another, into a new Track.- Specified by:
muxin interfaceComposerService- 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 fails- See Also:
-
mux
Mux multiple tracks into a new Track.- Specified by:
muxin interfaceComposerService- Parameters:
sourceTracks- The source tracksprofileId- The profile to use for encoding- Returns:
- The receipt for this encoding job
- Throws:
EncoderException- if encoding fails- See Also:
-
getProfile
Gets a profile by its ID- Specified by:
getProfilein interfaceComposerService- Parameters:
profileId- The profile ID- Returns:
- The encoding profile, or null if no profile is registered with that ID
- See Also:
-
image
Extracts an image from the media package element identified bysourceVideoTrackId. The image is taken at the timepointtimeseconds into the movie.- Specified by:
imagein interfaceComposerService- Parameters:
sourceTrack- the source video trackprofileId- identifier of the encoding profiletimes- number of seconds into the video- Returns:
- the extracted image as an attachment
- Throws:
EncoderException- if image extraction fails
-
imageSync
public List<Attachment> imageSync(Track sourceTrack, String profileId, double... times) throws EncoderException, MediaPackageException Description copied from interface:ComposerServiceSynchronously 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.- Specified by:
imageSyncin interfaceComposerService- Parameters:
sourceTrack- the source video trackprofileId- identifier of the encoding profiletimes- number of seconds into the video- Returns:
- the extracted images as attachments
- Throws:
EncoderException- if image extraction failsMediaPackageException- if the mediapackage is invalid
-
image
public 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.- Specified by:
imagein interfaceComposerService- 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- See Also:
-
convertImage
public Job convertImage(Attachment image, String... profileIds) throws EncoderException, MediaPackageException Converts the given image to a different image format using the specified image profiles.- Specified by:
convertImagein interfaceComposerService- 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- See Also:
-
convertImageSync
public 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.- Specified by:
convertImageSyncin interfaceComposerService- 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- See Also:
-
listProfiles
- Specified by:
listProfilesin interfaceComposerService- Returns:
- All registered
EncodingProfiles. - See Also:
-
buildTimeArray
Builds string containing times in seconds separated by comma.- Parameters:
times- time array to be converted to string- Returns:
- string represented specified time array
-
composite
public Job composite(Dimension compositeTrackSize, Optional<LaidOutElement<Track>> upperTrack, LaidOutElement<Track> lowerTrack, Optional<LaidOutElement<Attachment>> watermark, String profileId, String background, String sourceAudioName) throws EncoderException, MediaPackageException Description copied from interface:ComposerServiceCompose two videos into one with an optional watermark.- Specified by:
compositein interfaceComposerService- Parameters:
compositeTrackSize- The composite track dimensionupperTrack- upper track element from mediapackage (optional)lowerTrack- lower track element from mediapackagewatermark- watermark element (optional)profileId- Encoding profile namebackground- 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
public Job concat(String profileId, Dimension outputDimension, boolean sameCodec, Track... tracks) throws EncoderException, MediaPackageException Description copied from interface:ComposerServiceConcat multiple tracks to a single track.- Specified by:
concatin interfaceComposerService- 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
public Job concat(String profileId, Dimension outputDimension, float outputFrameRate, boolean sameCodec, Track... tracks) throws EncoderException, MediaPackageException Description copied from interface:ComposerServiceConcat multiple tracks to a single track. Required ffmpeg version 1.1- Specified by:
concatin interfaceComposerService- 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
public Job imageToVideo(Attachment sourceImageAttachment, String profileId, double time) throws EncoderException, MediaPackageException Description copied from interface:ComposerServiceTransforms an image attachment to a video track- Specified by:
imageToVideoin interfaceComposerService- Parameters:
sourceImageAttachment- The source image attachmentprofileId- The profile to use for encodingtime- 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
-
demux
public Job demux(Track sourceTrack, String profileId) throws EncoderException, MediaPackageException Description copied from interface:ComposerServiceDemux 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- Specified by:
demuxin interfaceComposerService- Parameters:
sourceTrack-profileId-- Returns:
- Receipt for this demux based on the profile
- Throws:
EncoderExceptionMediaPackageException
-
processSmil
public Job processSmil(Smil smil, String trackParamGroupId, String mediaType, List<String> profileIds) throws EncoderException, MediaPackageException Description copied from interface:ComposerServiceReads 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).- Specified by:
processSmilin interfaceComposerService- 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
public Job multiEncode(Track sourceTrack, List<String> profileIds) throws EncoderException, MediaPackageException Description copied from interface:ComposerServiceEncodes a track to set of media targets as defined by a list of encoding profiles- Specified by:
multiEncodein interfaceComposerService- Parameters:
sourceTrack- - 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
-