Package tv.hd3g.fflauncher
Class FFmpeg
- java.lang.Object
-
- tv.hd3g.fflauncher.ConversionTool
-
- tv.hd3g.fflauncher.FFbase
-
- tv.hd3g.fflauncher.FFmpeg
-
- All Implemented Interfaces:
tv.hd3g.processlauncher.tool.ExecutableTool
public class FFmpeg extends FFbase
-
-
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
execName, input_sources, output_expected_destinations, parameters
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FFmpegaddAudioCodecName(String codec_name, int output_audio_stream_index)No checks will be done.FFmpegaddBitrate(int bitrate, FFUnit bitrate_unit, int output_video_stream_index)FFmpegaddBitrateControl(int min_rate, int max_rate, int bufsize, FFUnit bitrate_unit)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(LinkedHashMap<String,String> configuration)Use nvresize Not checks will be doneFFmpegaddHardwareNVScalerFilter(Point new_size, String pixel_format, String interp_algo)Not checks will be done NVIDIA Performance Primitives via libnpp.FFmpegaddHardwareVideoDecoding(String source, tv.hd3g.ffprobejaxb.FFprobeJAXB analysing_result, FFmpeg.FFHardwareCodec hardware_codec, FFAbout about)"Patch" ffmpeg command line for hardware decoding.FFmpegaddHardwareVideoEncoding(String dest_codec_name, int output_video_stream_index, FFmpeg.FFHardwareCodec hardware_codec, FFAbout about)Set codec name, and if it possible, use hardware encoding.FFmpegaddIBQfactor(float i_qfactor, float b_qfactor)FFmpegaddMap(int source_index, int stream_index_in_source)No checks will be done.FFmpegaddPreset(FFmpeg.Preset preset)FFmpegaddQMinMax(int qmin, int qmax)FFmpegaddSimpleOutputDestination(File destination_file, String destination_container)Define cmd var name like <%OUT_AUTOMATIC_n%> with "n" the # of setted destination.FFmpegaddSimpleOutputDestination(String destination_name, String destination_container)Define cmd var name like <%OUT_AUTOMATIC_n%> with "n" the # of setted destination.FFmpegaddTune(FFmpeg.Tune tune)FFmpegaddVideoCodecName(String codec_name, int output_video_stream_index)No checks will be done.FFmpegaddVsync(int value)No checks will be done.intgetDevice_id_to_use()static Optional<org.ffmpeg.ffprobe.StreamType>getFirstVideoStream(tv.hd3g.ffprobejaxb.FFprobeJAXB analysing_result)FFmpegsetDeviceIdToUse(int device_id_to_use)Used with hardware transcoding.-
Methods inherited from class tv.hd3g.fflauncher.FFbase
addSimpleInputSource, addSimpleInputSource, addSimpleInputSource, addSimpleInputSource, beforeRun, 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, addSimpleOutputDestination, addSimpleOutputDestination, checkDestinations, checkSources, cleanUpOutputFiles, getDeclaredDestinationByVarName, getDeclaredDestinations, getDeclaredSourceByVarName, getDeclaredSources, getExecutableName, getFilterForLinesEventsToDisplay, getInternalParameters, getMaxExecTime, getMaxExecTimeScheduler, getOutputFiles, getParametersVariables, getReadyToRunParameters, getStdOutPrintStreamToDisplayLinesEvents, getWorkingDirectory, isCheckSourcesBeforeReady, isOnErrorDeleteOutFiles, isRemoveParamsIfNoVarToInject, onMissingInputOutputVar, setCheckSourcesBeforeReady, setFilterForLinesEventsToDisplay, setMaxExecTimeScheduler, setMaxExecutionTimeForShortCommands, setOnErrorDeleteOutFiles, setRemoveParamsIfNoVarToInject, setWorkingDirectory
-
-
-
-
Constructor Detail
-
FFmpeg
public FFmpeg(String execName, tv.hd3g.processlauncher.cmdline.Parameters parameters)
-
-
Method Detail
-
addSimpleOutputDestination
public FFmpeg addSimpleOutputDestination(String destination_name, String destination_container)
Define cmd var name like <%OUT_AUTOMATIC_n%> with "n" the # of setted destination. Add "-f container destination"
-
addSimpleOutputDestination
public FFmpeg addSimpleOutputDestination(File destination_file, String destination_container)
Define cmd var name like <%OUT_AUTOMATIC_n%> with "n" the # of setted destination. Add "-f container /destination"
-
addFastStartMovMp4File
public FFmpeg addFastStartMovMp4File()
Add "-movflags faststart" Please, put it a the end of command line, before output stream.
-
addHardwareNVScalerFilter
public FFmpeg addHardwareNVScalerFilter(Point new_size, String pixel_format, String interp_algo)
Not checks will be done NVIDIA Performance Primitives via libnpp. Via -vf ffmpeg's option.- Parameters:
new_size- like 1280x720 or -1x720pixel_format- can be null (== same) or nv12, yuv444p16...interp_algo- 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(LinkedHashMap<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 analysing_result)
-
setDeviceIdToUse
public FFmpeg setDeviceIdToUse(int device_id_to_use)
Used with hardware transcoding.- Parameters:
device_id_to_use- -1 by default
-
getDevice_id_to_use
public int getDevice_id_to_use()
- Returns:
- -1 by default
-
addHardwareVideoDecoding
public FFmpeg addHardwareVideoDecoding(String source, tv.hd3g.ffprobejaxb.FFprobeJAXB analysing_result, FFmpeg.FFHardwareCodec hardware_codec, 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 dest_codec_name, int output_video_stream_index, FFmpeg.FFHardwareCodec hardware_codec, FFAbout about) throws MediaException
Set codec name, and if it possible, use hardware encoding.- Parameters:
dest_codec_name-output_video_stream_index- (-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 bitrate_unit, int output_video_stream_index)
- Parameters:
output_video_stream_index- -1 by default
-
addBitrateControl
public FFmpeg addBitrateControl(int min_rate, int max_rate, int bufsize, FFUnit bitrate_unit)
- Parameters:
min_rate- set -1 for defaultmax_rate- set -1 for defaultbufsize- set -1 for default
-
addCRF
public FFmpeg addCRF(int crf)
Constant bitrate factor, 0=lossless.
-
addVideoCodecName
public FFmpeg addVideoCodecName(String codec_name, int output_video_stream_index)
No checks will be done. See FFmpeg.addVideoEncoding for hardware use- Parameters:
output_video_stream_index- -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 codec_name, int output_audio_stream_index)
No checks will be done.- Parameters:
output_audio_stream_index- -1 by default
-
addVsync
public FFmpeg addVsync(int value)
No checks will be done. like -vsync value
-
addMap
public FFmpeg addMap(int source_index, int stream_index_in_source)
No checks will be done. like -map source_index:stream_index_in_source ; 0 is the first.
-
-