001/* 002 * (C) Copyright 2016 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Ricardo Dias 018 */ 019package org.nuxeo.ecm.platform.video.tools; 020 021import org.nuxeo.ecm.core.api.Blob; 022import java.util.List; 023 024/** 025 * Service that allows the execution of different operations in video blobs through the execution of {@link VideoTool}. 026 * 027 * @since 8.4 028 */ 029public interface VideoToolsService { 030 031 /** 032 * Extracts the closed captions from a video blob. 033 * 034 * @param video the input blob 035 * @param outputFormat the outformat of the captions (srt, txt, ttxt is the default) 036 * @param startAt the start time in format "xx:xx" 037 * @param endAt the end time in format "xx:xx" 038 * @return the closed captions if any were found 039 */ 040 Blob extractClosedCaptions(Blob video, String outputFormat, String startAt, String endAt); 041 042 /** 043 * Concat the input video blobs into a single video blob. 044 * 045 * @param videos 046 * @return video blob with the videos concatenated 047 */ 048 Blob concat(List<Blob> videos); 049 050 /** 051 * Slices a video blob from a start time and the input duration. 052 * If start it empty, the blob will be sliced in n-parts with similar duration. 053 * If duration is empty, the video blob will be sliced from startAt until the end. 054 * 055 * @param video the input blob 056 * @param startAt the start time in "xx:xx" format 057 * @param duration the duration of the sliced blob in seconds 058 * @param encode option to re-encode the ouptut video blob 059 * @return video blobs generated by the slicer 060 */ 061 List<Blob> slice(Blob video, String startAt, String duration, boolean encode); 062 063 /** 064 * Add a watermark to a video blob. 065 * 066 * @param video the input blob 067 * @param picture the picture blob to be used as the watermark 068 * @param x the x offset starting from the left 069 * @param y the y offset starting from the top 070 * @return a video blob with a watermark at the position specified 071 */ 072 Blob watermark(Blob video, Blob picture, String x, String y); 073 074 /** 075 * Checks if a determined tool is available. 076 * 077 * @param toolName the name of the tool 078 * @return true if the tool is available or false otherwise 079 */ 080 boolean isToolAvailable(String toolName); 081}