Package nzilbb.media

Interface MediaCensor

  • All Known Subinterfaces:
    IMediaCensor
    All Known Implementing Classes:
    FfmpegCensor

    public interface MediaCensor
    Censors media by taking a series of time points and obfuscating every other interval between them.

    The method of obfuscation is implementation dependent (e.g. silence or low-pass filter for audio, or blacking out or pixellation for video), but the result should be a media file of the same type and same length.

    Author:
    Robert Fromont robert@fromont.net.nz
    • Method Detail

      • configure

        ParameterSet configure​(ParameterSet configuration)
                        throws MediaException
        Configure the censor. This might include executable paths, obfuscation 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.

        Parameters:
        configuration - The configuration for the censor.
        Returns:
        A list of configuration parameters must be set before the censor can be used.
        Throws:
        MediaException - If an error occurs.
      • typeSupported

        boolean typeSupported​(String sourceType)
                       throws MediaException
        Determines whether this censor supports censoring of media of the given type.
        Parameters:
        sourceType - The MIME type of the source media.
        Returns:
        true if the censor can censor media of sourceType, false otherwise.
        Throws:
        MediaException - If an error occurs.
      • start

        MediaThread start​(String sourceType,
                          File source,
                          List<Double> boundaries,
                          File destination)
                   throws MediaException
        Starts censoring.

        The boundaries are a list of time points in seconds, which define the boundaries of contiguous intervals. Every second interval (starting from the first point) will be censored. An initial uncensored portion starting at 0s is assumed, so only add a point at 0.0 if you want the first censored interval to start at 0s. e.g.

        • If boundaries is empty, then destination will have no obfuscated intervals (it will be a copy of source).
        • If boundaries contains one point, at 1.0, then the media from 0.0-1.0 will be uncensored, and from 1.0 onward will be obfuscated.
        • If boundaries contains two points, at 1.0 and 2.0, then the media from 0.0-1.0 will be uncensored, from 1.0-2.0 will be obfuscated, and from 2.0 onward will be uncensored.
        • If boundaries contains three points, at 0.0, 1.0, and 2.0, then the media from 0.0-1.0 will be obfuscated, from 1.0-2.0 will be uncensored, and from 2.0 onward will be obfuscated.
        Parameters:
        sourceType - The MIME type of the source media.
        source - The (old) original file.
        boundaries - A list of time points, in seconds, which define the boundaries of contiguous intervals.
        destination - The (new) censored file.
        Returns:
        A thread that is processing the media.
        Throws:
        MediaException - If an error occurs.