public class FFmpegVideoUtil
extends java.lang.Object
Constructor and Description |
---|
FFmpegVideoUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
changeVideoCodecs(java.util.List<FFmpegVideo> videos)
Public function to change video codecs if they are not "h264" which would be
.mp4 codec
|
static java.lang.String |
checkCodec(java.lang.String videoPath)
Public function that will check the codec of a video path that is given by
using ffprobe
|
static java.util.List<java.lang.String> |
cleanLocation(java.lang.String local)
Clean location once it is found
|
static java.lang.String |
combineVideosToCollage(java.util.List<EnhancedObjectContent> ecos,
java.util.List<java.util.List<Annotation>> allVideoAnnotations,
java.lang.Integer minStartTime,
java.lang.Integer maxEndTime)
Public function that creates a video collage of the four passed-in video
inputStreams and sets it on the response
|
static java.io.File |
createFinalCollage(java.lang.String finalCollageFileFullPath,
java.util.List<FFmpegVideo> videos,
java.util.List<java.lang.String> mergedVideos)
Merges together all of the video collages to create final video
|
static void |
createUniformLengthVideoClips(java.lang.Integer start,
java.lang.Integer duration,
java.util.List<FFmpegVideo> videos)
Calls clip_video on all videos to create clips at given start time for given
duration
|
static void |
createVideoClip(java.lang.String videoPath,
java.lang.String start,
java.lang.String duration,
java.lang.String outputPath)
Creates a clip of video at given start and end times
|
static java.io.File |
createVideoCollageByAnnotations(java.util.List<java.util.List<Annotation>> allVideoAnnotations,
java.util.List<EnhancedObjectContent> ecos,
java.lang.Integer minStartTime,
java.lang.Integer maxEndTime,
java.util.List<FFmpegVideo> videos)
Public function that creates collages of the selected videos based on their
annotations.
|
static void |
deleteVideoClipsByName(java.util.List<java.lang.String> videoNames)
Deletes all of the video clips in the working directory
|
static void |
executeMergeVideoCommands(java.lang.String outputFile,
java.util.List<FFmpegVideo> videos)
Creates a video collage out of the clips that have been created.
|
static java.io.File |
getTempFile(java.io.InputStream content,
java.lang.String name)
public function that creates a temporary mp4 file with the passed-in name and
content
|
static java.util.List<java.lang.String> |
getVideoData(java.lang.String videoFileName,
java.lang.String query)
Gets the video data from a video file using FFprobe
|
static void |
prioritize(java.lang.String videoName,
java.util.List<FFmpegVideo> videos)
Sets the priority of all videos.
|
static void |
runCommand(java.util.List<java.lang.String> command)
runs list of string commands on system command line
|
static java.util.List<java.lang.String> |
searchMetadata(org.json.JSONObject obj,
java.lang.String query)
Recursively iterate through whole json obj and check if query can be pulled
If it can, the items that it found will be returned
|
public static java.lang.String combineVideosToCollage(java.util.List<EnhancedObjectContent> ecos, java.util.List<java.util.List<Annotation>> allVideoAnnotations, java.lang.Integer minStartTime, java.lang.Integer maxEndTime)
{List}
- ecos list of the enhanced object
contents that will be merged{List}
- allVideoAnnotations list of all video annotations{Integer}
- minStartTime the min start time for the selected videos
(start time of first annotation){Integer}
- maxEndTime the max end time for the selected videos (end
time of the last annotation)public static java.io.File getTempFile(java.io.InputStream content, java.lang.String name)
content
- - the content of the temporary filename
- - the name of the temporary filepublic static java.io.File createVideoCollageByAnnotations(java.util.List<java.util.List<Annotation>> allVideoAnnotations, java.util.List<EnhancedObjectContent> ecos, java.lang.Integer minStartTime, java.lang.Integer maxEndTime, java.util.List<FFmpegVideo> videos) throws java.lang.InterruptedException, java.io.IOException
{List>}
- allVideoAnnotations: a master list of all the
annotations for the videos that will be merged together.{List}
- ecos: list of the enhanced object
contents that will be merged{String}
- finalCollageFileFullPath: the filepath where the final merged
video will live{Integer}
- minStartTime: the min start time for the selected videos
(start time of first annotation){Integer}
- maxEndTime: the max end time for the selected videos (end
time of the last annotation){List}
- videos: list of the FFmpegvideo objects for the
videos that will be mergedIOException,
- InterruptedExceptionjava.lang.InterruptedException
java.io.IOException
public static void changeVideoCodecs(java.util.List<FFmpegVideo> videos) throws java.lang.InterruptedException
{List}
- videos: list of video files to be processedjava.lang.InterruptedException
public static java.lang.String checkCodec(java.lang.String videoPath)
{String}
- videoPath: path to the video file that is about to be checkedjava.io.IOException
java.lang.InterruptedException
public static java.io.File createFinalCollage(java.lang.String finalCollageFileFullPath, java.util.List<FFmpegVideo> videos, java.util.List<java.lang.String> mergedVideos) throws java.io.IOException, java.lang.InterruptedException
{String}
- finalCollageFileFullPath: the filepath where the final merged
video will live{List}
- videos: list of the FFmpegvideo objects for the
videos that will be merged{List}
- mergedVideos: master list of all of the video collages
that have been madejava.io.IOException
java.lang.InterruptedException
public static void createUniformLengthVideoClips(java.lang.Integer start, java.lang.Integer duration, java.util.List<FFmpegVideo> videos) throws java.lang.InterruptedException
{Integer}
- start: time that the clip will start at{Integer}
- duration: how long the clip will be{List}
- videos: list of the FFmpegvideo objects for the
videos that will be mergedjava.lang.InterruptedException
public static void prioritize(java.lang.String videoName, java.util.List<FFmpegVideo> videos)
{String}
- videoName: name of the video that needs to be marked as video
in priority{List}
- videos: list of the FFmpegvideo objects for the
videos that will be mergedpublic static void executeMergeVideoCommands(java.lang.String outputFile, java.util.List<FFmpegVideo> videos) throws java.lang.InterruptedException
{String}
- outputFile : path to the output file - the new merged video{List}
- videos: list of the FFmpegvideo objects for the
videos that will be mergedjava.lang.InterruptedException
public static void deleteVideoClipsByName(java.util.List<java.lang.String> videoNames) throws java.lang.InterruptedException
{List}
- videoNames: list of all of the videos that need to be
deleted from working directoryjava.lang.InterruptedException
public static java.util.List<java.lang.String> getVideoData(java.lang.String videoFileName, java.lang.String query) throws org.json.JSONException, java.lang.InterruptedException
{String}
- videoFileName the path to the video that the metadata is
being pulled from{String}
- query: param that the we are searching metadata for (i.e.
setting query to "duration" will search the video metadata for the
duration tag)org.json.JSONException
java.lang.InterruptedException
public static java.util.List<java.lang.String> searchMetadata(org.json.JSONObject obj, java.lang.String query) throws org.json.JSONException
{JSONObject}
- obj the json object that is pull from the video by
ffprobeorg.json.JSONException
public static java.util.List<java.lang.String> cleanLocation(java.lang.String local)
{String}
- local the GPS coordinates of where the video was createdpublic static void createVideoClip(java.lang.String videoPath, java.lang.String start, java.lang.String duration, java.lang.String outputPath) throws java.lang.InterruptedException
:
- String videoPath : absolute path to video file:
- String start : starting second of video clip:
- String duration : ending second of video clip:
- String outputPath : absolute path and name of output videojava.lang.InterruptedException
public static void runCommand(java.util.List<java.lang.String> command) throws java.lang.InterruptedException
{List}
- commandjava.lang.InterruptedException