Package tv.hd3g.fflauncher
Class FFmpeg
- java.lang.Object
-
- tv.hd3g.fflauncher.ConversionTool
-
- tv.hd3g.fflauncher.FFbase
-
- tv.hd3g.fflauncher.FFmpeg
-
- All Implemented Interfaces:
InputGeneratorsTraits,tv.hd3g.processlauncher.tool.ExecutableTool
public class FFmpeg extends FFbase implements InputGeneratorsTraits
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFFmpeg.FFHardwareCodecstatic classFFmpeg.Presetstatic classFFmpeg.Tune
-
Field Summary
-
Fields inherited from class tv.hd3g.fflauncher.ConversionTool
APPEND_PARAM_AT_END, execName, inputSources, outputExpectedDestinations, parameters, PREPEND_PARAM_AT_START
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FFmpegaddAudioCodecName(String codecName, int outputAudioStreamIndex)No checks will be done.FFmpegaddBitrate(int bitrate, FFUnit bitrateUnit, int outputVideoStreamIndex)FFmpegaddBitrateControl(int minRate, int maxRate, int bufsize, FFUnit bitrateUnit)FFmpegaddCRF(int crf)Constant bitrate factor, 0=lossless.FFmpegaddFastStartMovMp4File()Add "-movflags faststart" Please, put it a the end of command line, before output stream.FFmpegaddGOPControl(int b_frames, int gop_size, int ref_frames)FFmpegaddHardwareNVMultipleScalerFilterComplex(Map<String,String> configuration)Use nvresize Not checks will be doneFFmpegaddHardwareNVScalerFilter(Point newSize, String pixelFormat, String interpAlgo)Not checks will be done NVIDIA Performance Primitives via libnpp.FFmpegaddHardwareVideoDecoding(String source, tv.hd3g.ffprobejaxb.FFprobeJAXB analysingResult, FFmpeg.FFHardwareCodec hardwareCodec, FFAbout about)"Patch" ffmpeg command line for hardware decoding.FFmpegaddHardwareVideoEncoding(String destCodecName, int outputVideoStreamIndex, FFmpeg.FFHardwareCodec hardwareCodec, FFAbout about)Set codec name, and if it possible, use hardware encoding.FFmpegaddIBQfactor(float i_qfactor, float b_qfactor)FFmpegaddMap(int sourceIndex, int streamIndexInSource)No checks will be done.FFmpegaddPreset(FFmpeg.Preset preset)FFmpegaddQMinMax(int qmin, int qmax)FFmpegaddSimpleOutputDestination(File destinationFile, String destinationContainer)Define cmd var name like <%OUT_AUTOMATIC_n%> with "n" the # of setted destination.FFmpegaddSimpleOutputDestination(String destinationName, String destinationContainer)Define cmd var name like <%OUT_AUTOMATIC_n%> with "n" the # of setted destination.FFmpegaddTune(FFmpeg.Tune tune)FFmpegaddVideoCodecName(String codecName, int outputVideoStreamIndex)No checks will be done.FFmpegaddVsync(int value)No checks will be done.intgetDeviceIdToUse()static Optional<org.ffmpeg.ffprobe.StreamType>getFirstVideoStream(tv.hd3g.ffprobejaxb.FFprobeJAXB analysingResult)FFmpegsetDeviceIdToUse(int deviceIdToUse)Used with hardware transcoding.-
Methods inherited from class tv.hd3g.fflauncher.FFbase
addSimpleInputSource, addSimpleInputSource, addSimpleInputSource, addSimpleInputSource, addSimpleOutputDestination, addSimpleOutputDestination, beforeRun, checkFiltersAvailability, filterOutErrorLines, getAbout, getStdErrPrintStreamToDisplayLinesEvents, isHidebanner, isLogLevelSet, isNeverOverwriteOutputFiles, isOverwriteOutputFiles, setHidebanner, setLogLevel, setNeverOverwriteOutputFiles, setOverwriteOutputFiles
-
Methods inherited from class tv.hd3g.fflauncher.ConversionTool
addInputSource, addInputSource, addInputSource, addInputSource, addOutputDestination, addOutputDestination, addOutputDestination, addOutputDestination, checkDestinations, checkSources, cleanUpOutputFiles, fixIOParametredVars, fixIOParametredVars, getDeclaredDestinationByVarName, getDeclaredDestinations, getDeclaredSourceByVarName, getDeclaredSources, getExecutableName, getFilterForLinesEventsToDisplay, getInternalParameters, getMaxExecTime, getMaxExecTimeScheduler, getOutputFiles, getParametersVariables, getReadyToRunParameters, getStdOutPrintStreamToDisplayLinesEvents, getWorkingDirectory, isCheckSourcesBeforeReady, isOnErrorDeleteOutFiles, isRemoveParamsIfNoVarToInject, onMissingInputOutputVar, patchVarName, setCheckSourcesBeforeReady, setFilterForLinesEventsToDisplay, setMaxExecTimeScheduler, setMaxExecutionTimeForShortCommands, setOnErrorDeleteOutFiles, setRemoveParamsIfNoVarToInject, setWorkingDirectory
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface tv.hd3g.fflauncher.InputGeneratorsTraits
addSimpleInputSource, addSineAudioGeneratorAsInputSource, addSmptehdbarsGeneratorAsInputSource
-
-
-
-
Constructor Detail
-
FFmpeg
public FFmpeg(String execName, tv.hd3g.processlauncher.cmdline.Parameters parameters)
-
-
Method Detail
-
addSimpleOutputDestination
public FFmpeg addSimpleOutputDestination(String destinationName, String destinationContainer)
Define cmd var name like <%OUT_AUTOMATIC_n%> with "n" the # of setted destination. Add "-f container destination" Don't forget to call fixIOParametredVars
-
addSimpleOutputDestination
public FFmpeg addSimpleOutputDestination(File destinationFile, String destinationContainer)
Define cmd var name like <%OUT_AUTOMATIC_n%> with "n" the # of setted destination. Add "-f container /destination" Don't forget to call fixIOParametredVars
-
addFastStartMovMp4File
public FFmpeg addFastStartMovMp4File()
Add "-movflags faststart" Please, put it a the end of command line, before output stream.
-
addHardwareNVScalerFilter
public FFmpeg addHardwareNVScalerFilter(Point newSize, String pixelFormat, String interpAlgo)
Not checks will be done NVIDIA Performance Primitives via libnpp. Via -vf ffmpeg's option.- Parameters:
newSize- like 1280x720 or -1x720pixelFormat- can be null (== same) or nv12, yuv444p16...interpAlgo- can be null or nn (Nearest neighbour), linear (2-parameter cubic (B=1, C=0)), cubic2p_catmullrom (2-parameter cubic (B=0, C=1/2)), cubic2p_b05c03 (2-parameter cubic (B=1/2, C=3/10)), super (Supersampling), lanczos ...
-
addHardwareNVMultipleScalerFilterComplex
public FFmpeg addHardwareNVMultipleScalerFilterComplex(Map<String,String> configuration)
Use nvresize Not checks will be done- Parameters:
configuration- resolution -> filter out name ; resolution can be litteral like hd1080 or cif and filter out name can be "out0", usable after with "-map [out0] -vcodec xxx out.ext"
-
getFirstVideoStream
public static Optional<org.ffmpeg.ffprobe.StreamType> getFirstVideoStream(tv.hd3g.ffprobejaxb.FFprobeJAXB analysingResult)
-
setDeviceIdToUse
public FFmpeg setDeviceIdToUse(int deviceIdToUse)
Used with hardware transcoding.- Parameters:
deviceIdToUse- -1 by default
-
getDeviceIdToUse
public int getDeviceIdToUse()
- Returns:
- -1 by default
-
addHardwareVideoDecoding
public FFmpeg addHardwareVideoDecoding(String source, tv.hd3g.ffprobejaxb.FFprobeJAXB analysingResult, FFmpeg.FFHardwareCodec hardwareCodec, FFAbout about) throws MediaException
"Patch" ffmpeg command line for hardware decoding. Only first video stream will be decoded. Hardware decoding often works in tandem with hardware coding.- Throws:
MediaException- if hardware decoding is not possible.
-
addHardwareVideoEncoding
public FFmpeg addHardwareVideoEncoding(String destCodecName, int outputVideoStreamIndex, FFmpeg.FFHardwareCodec hardwareCodec, FFAbout about) throws MediaException
Set codec name, and if it possible, use hardware encoding.- Parameters:
destCodecName-outputVideoStreamIndex- (-1 by default), X -> -c:v:X- Throws:
MediaException
-
addPreset
public FFmpeg addPreset(FFmpeg.Preset preset)
-
addTune
public FFmpeg addTune(FFmpeg.Tune tune)
-
addBitrate
public FFmpeg addBitrate(int bitrate, FFUnit bitrateUnit, int outputVideoStreamIndex)
- Parameters:
outputVideoStreamIndex- -1 by default
-
addBitrateControl
public FFmpeg addBitrateControl(int minRate, int maxRate, int bufsize, FFUnit bitrateUnit)
- Parameters:
minRate- set -1 for defaultmaxRate- set -1 for defaultbufsize- set -1 for default
-
addCRF
public FFmpeg addCRF(int crf)
Constant bitrate factor, 0=lossless.
-
addVideoCodecName
public FFmpeg addVideoCodecName(String codecName, int outputVideoStreamIndex)
No checks will be done. See FFmpeg.addVideoEncoding for hardware use- Parameters:
outputVideoStreamIndex- -1 by default
-
addGOPControl
public FFmpeg addGOPControl(int b_frames, int gop_size, int ref_frames)
- Parameters:
b_frames- set 0 for defaultgop_size- set 0 for defaultref_frames- set 0 for default
-
addIBQfactor
public FFmpeg addIBQfactor(float i_qfactor, float b_qfactor)
- Parameters:
i_qfactor- set 0 for defaultb_qfactor- set 0 for default
-
addQMinMax
public FFmpeg addQMinMax(int qmin, int qmax)
- Parameters:
qmin- set 0 for defaultqmax- set 0 for default
-
addAudioCodecName
public FFmpeg addAudioCodecName(String codecName, int outputAudioStreamIndex)
No checks will be done.- Parameters:
outputAudioStreamIndex- -1 by default
-
addVsync
public FFmpeg addVsync(int value)
No checks will be done. like -vsync value
-
addMap
public FFmpeg addMap(int sourceIndex, int streamIndexInSource)
No checks will be done. like -map sourceIndex:streamIndexInSource ; 0 is the first.
-
-