Package com.day.cq.dam.handler.ffmpeg
Class FFMpegWrapper
java.lang.Object
com.day.cq.dam.handler.ffmpeg.FFMpegWrapper
-
Constructor Summary
ConstructorsConstructorDescriptionFFMpegWrapper(File file) Creates a wrapper to run ffmpeg for the given video file.FFMpegWrapper(File file, File workingDir) Creates a wrapper to run ffmpeg for the given video file. -
Method Summary
Modifier and TypeMethodDescriptionstatic FFMpegWrapperfromProfile(File inputFile, VideoProfile profile, File workingDir) Turns a video profile into a FFMpegWrapper.Create clip from the video.getFilmStrip(int frames, int width) longgetThumbnails(int thumbnails, int start) Create thumbnails from the video.voidsetAudioBitrate(int audioBitrate) voidsetAudioChannels(int i) voidsetAudioCodec(String audioCodec) voidsetAudioSamplingRate(int audioSamplingRate) voidsetBitrate(int bitrate) Sets the output video bitrate in kbits/secondvoidsetBitrateTolerance(int i) voidsetClipDuration(long i) voidsetCropArea(Rectangle rectangle) voidsetCustomFlags(String[] flags) voidsetDuration(long duration) voidsetExecutableLocator(ExecutableLocator locator) voidvoidsetFitInside(boolean fitInside) voidvoidvoidsetInputsize(Dimension inputsize) voidvoidsetLetterbox(boolean letterbox) voidsetOutputExtension(String extension) voidsetOutputMimetype(String outputMimetype) voidsetOutputSize(Dimension dimension) voidvoidsetProfileName(String profileName) voidsetRenditionSelector(String renditionSelector) voidsetStartTime(long i) voidvoidsetTwoPass(boolean twoPass) voidsetVideoCodec(String videoCodec)
-
Constructor Details
-
FFMpegWrapper
Creates a wrapper to run ffmpeg for the given video file. Will run ffmpeg in the current working directory of JVM.- Parameters:
file- video file to call ffmpeg with
-
FFMpegWrapper
Creates a wrapper to run ffmpeg for the given video file. Provide a different workingDir every time you create thisFFMpegWrapperas ffmpeg's temp file name in 2-pass encoding is hard coded in the ffmpeg build, which causes problem while running simultaneous multiple encodings. Even you use -passlogfile option, x264_2pass.log file name is hard coded in the older ffmpeg builds. For more details please refer to bug:42346.- Parameters:
file- video file to call ffmpeg withworkingDir- a working directory for ffmpeg; ifnull, the current working directory of the JVM is used
-
-
Method Details
-
getOutputExtension
-
setOutputExtension
-
getFFMpegOutput
-
getProfileName
-
setProfileName
-
getRenditionSelector
-
setRenditionSelector
-
getOutputMimetype
-
setOutputMimetype
-
setTwoPass
public void setTwoPass() -
setTwoPass
public void setTwoPass(boolean twoPass) -
setPreset
-
setAudioSamplingRate
public void setAudioSamplingRate(int audioSamplingRate) -
setAudioBitrate
public void setAudioBitrate(int audioBitrate) -
setVideoCodec
-
setAudioCodec
-
setBitrate
public void setBitrate(int bitrate) Sets the output video bitrate in kbits/second- Parameters:
bitrate- The bitrate
-
setInput
-
setExecutableLocator
-
setOutputSize
-
getOutputSize
-
getInputDuration
public long getInputDuration() -
getInputSize
-
getThumbnails
Create thumbnails from the video.- Parameters:
thumbnails- The number of desired thumbnails.start- The start position in seconds from where to take the first thumbnail.- Returns:
- The thumbnails.
-
getClip
Create clip from the video.- Parameters:
startTime- startTime of the clip.endTime- The end position in seconds of the clip.mimeType- Mime type for the clip.- Returns:
- The thumbnails.
-
join
- Throws:
IOException
-
trim
- Throws:
IOException
-
transcode
- Throws:
IOException
-
transcode
- Throws:
IOException
-
setLetterbox
public void setLetterbox() -
setLetterbox
public void setLetterbox(boolean letterbox) -
setFitInside
public void setFitInside() -
setFitInside
public void setFitInside(boolean fitInside) -
getFilmStrip
-
setFps
-
setBitrateTolerance
public void setBitrateTolerance(int i) -
setAudioChannels
public void setAudioChannels(int i) -
setCustomFlags
-
setStartTime
public void setStartTime(long i) -
setClipDuration
public void setClipDuration(long i) -
setCropArea
-
setInputsize
-
setDuration
public void setDuration(long duration) -
fromProfile
Turns a video profile into a FFMpegWrapper.- Parameters:
inputFile- property fileprofile- can be the cq:Page or jcr:content node of a profile pageworkingDir- working directory for ffmpeg- Returns:
- configured FFMpegWrapper
-