Class FFmpeg

    • 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 -1x720
        pixelFormat - 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
      • 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 default
        maxRate - set -1 for default
        bufsize - 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 default
        gop_size - set 0 for default
        ref_frames - set 0 for default
      • addIBQfactor

        public FFmpeg addIBQfactor​(float i_qfactor,
                                   float b_qfactor)
        Parameters:
        i_qfactor - set 0 for default
        b_qfactor - set 0 for default
      • addQMinMax

        public FFmpeg addQMinMax​(int qmin,
                                 int qmax)
        Parameters:
        qmin - set 0 for default
        qmax - 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.