Class VideoToolsServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.platform.video.tools.service.VideoToolsServiceImpl
-
- All Implemented Interfaces:
VideoToolsService
,Adaptable
,Component
,Extensible
,TimestampedService
public class VideoToolsServiceImpl extends DefaultComponent implements VideoToolsService
TheVideoToolsService
default implementation for handling video blobs. It provides extension points for handling video operations, such as concat, slice, watermark and extract closed captions.- Since:
- 8.4
-
-
Field Summary
Fields Modifier and Type Field Description protected static Log
log
protected Map<String,Class<?>>
videoTools
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description VideoToolsServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(ComponentContext context)
Activates the component.Blob
concat(List<Blob> videos)
Concat the input video blobs into a single video blob.Blob
extractClosedCaptions(Blob video, String outputFormat, String startAt, String endAt)
Extracts the closed captions from a video blob.boolean
isToolAvailable(String toolName)
Checks if a determined tool is available.protected CmdParameters
setupCmdParameters(Map<String,String> parameters)
List<Blob>
slice(Blob video, String startAt, String duration, boolean encode)
Slices a video blob from a start time and the input duration.Blob
watermark(Blob video, Blob picture, String x, String y)
Add a watermark to a video blob.-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterContribution, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
-
-
-
Method Detail
-
activate
public void activate(ComponentContext context)
Description copied from interface:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
extractClosedCaptions
public Blob extractClosedCaptions(Blob video, String outputFormat, String startAt, String endAt)
Description copied from interface:VideoToolsService
Extracts the closed captions from a video blob.- Specified by:
extractClosedCaptions
in interfaceVideoToolsService
- Parameters:
video
- the input bloboutputFormat
- the outformat of the captions (srt, txt, ttxt is the default)startAt
- the start time in format "xx:xx"endAt
- the end time in format "xx:xx"- Returns:
- the closed captions if any were found
-
concat
public Blob concat(List<Blob> videos)
Description copied from interface:VideoToolsService
Concat the input video blobs into a single video blob.- Specified by:
concat
in interfaceVideoToolsService
- Returns:
- video blob with the videos concatenated
-
slice
public List<Blob> slice(Blob video, String startAt, String duration, boolean encode)
Description copied from interface:VideoToolsService
Slices a video blob from a start time and the input duration. If start it empty, the blob will be sliced in n-parts with similar duration. If duration is empty, the video blob will be sliced from startAt until the end.- Specified by:
slice
in interfaceVideoToolsService
- Parameters:
video
- the input blobstartAt
- the start time in "xx:xx" formatduration
- the duration of the sliced blob in secondsencode
- option to re-encode the ouptut video blob- Returns:
- video blobs generated by the slicer
-
watermark
public Blob watermark(Blob video, Blob picture, String x, String y)
Description copied from interface:VideoToolsService
Add a watermark to a video blob.- Specified by:
watermark
in interfaceVideoToolsService
- Parameters:
video
- the input blobpicture
- the picture blob to be used as the watermarkx
- the x offset starting from the lefty
- the y offset starting from the top- Returns:
- a video blob with a watermark at the position specified
-
isToolAvailable
public boolean isToolAvailable(String toolName)
Description copied from interface:VideoToolsService
Checks if a determined tool is available.- Specified by:
isToolAvailable
in interfaceVideoToolsService
- Parameters:
toolName
- the name of the tool- Returns:
- true if the tool is available or false otherwise
-
setupCmdParameters
protected CmdParameters setupCmdParameters(Map<String,String> parameters)
-
-