Class FfmpegConverter

  • All Implemented Interfaces:
    MediaConverter

    public class FfmpegConverter
    extends Object
    implements MediaConverter
    MediaConverter implemented by executing ffmpeg
    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • FfmpegConverter

        public FfmpegConverter()
        Default constructor.
    • Method Detail

      • getFfmpeg

        public File getFfmpeg()
        Getter for ffmpeg: Executable file for ffmpeg.
        Returns:
        Executable file for ffmpeg.
      • setFfmpeg

        public void setFfmpeg​(File newFfmpeg)
        Setter for ffmpeg: Executable file for ffmpeg.
        Parameters:
        newFfmpeg - Executable file for ffmpeg.
      • getConversionCommandLine

        public String getConversionCommandLine()
        Getter for conversionCommandLine: Command line for conversion.
        Returns:
        Command line for conversion - default value is "-loglevel error -nostdin -strict experimental -i {0} -strict experimental {1}".
      • setConversionCommandLine

        public void setConversionCommandLine​(String newConversionCommandLine)
        Setter for conversionCommandLine: Command line for conversion.
        Parameters:
        newConversionCommandLine - Command line for conversion.
      • configure

        public ParameterSet configure​(ParameterSet configuration)
                               throws MediaException
        Configure the converter. This might include executable paths, conversion parameters, etc.

        This method can be invoked with an empty parameter set, to discover what (if any) parameters are required. If parameters are returned, and user interaction is possible, then the user may be presented with an interface for setting/confirming these parameters.

        Specified by:
        configure in interface MediaConverter
        Parameters:
        configuration - The configuration for the converter.
        Returns:
        A list of configuration parameters must be set before the converter can be used.
        Throws:
        MediaException - If an error occurs.
      • conversionSupported

        public boolean conversionSupported​(String sourceType,
                                           String destinationType)
                                    throws MediaException
        Determines whether this converter supports conversion between the given types.
        Specified by:
        conversionSupported in interface MediaConverter
        Parameters:
        sourceType - The MIME type of the source media.
        destinationType - The MIME type of the destination format.
        Returns:
        true if the converter can convert from the sourceType to the destinationType, false otherwise.
        Throws:
        MediaException - If an error occurs.
      • start

        public MediaThread start​(String sourceType,
                                 File source,
                                 String destinationType,
                                 File destination)
                          throws MediaException
        Starts conversion.
        Specified by:
        start in interface MediaConverter
        Parameters:
        sourceType - The MIME type of the source media.
        source - The source file.
        destinationType - The MIME type of the destination format.
        destination - The destination file.
        Returns:
        A thread that is processing the media.
        Throws:
        MediaException - If an error occurs.