Package nzilbb.media.ffmpeg
Class FfmpegCensor
- java.lang.Object
-
- nzilbb.media.ffmpeg.FfmpegCensor
-
- All Implemented Interfaces:
MediaCensor
public class FfmpegCensor extends Object implements MediaCensor
MediaCensor implemented by executing ffmpeg.- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Constructor Summary
Constructors Constructor Description FfmpegCensor()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParameterSet
configure(ParameterSet configuration)
Configure the censor.String
getAudioFilter()
Getter foraudioFilter
: Filter for obfuscating audio.Boolean
getDeleteSource()
Getter fordeleteSource
: Delete source file when finished.File
getFfmpeg()
Getter forffmpeg
: Executable file for ffmpeg.Boolean
getVerbose()
Getter forverbose
: Whether to output intervals and ffmpeg command line arguments to stderr or not.void
setAudioFilter(String newAudioFilter)
Setter foraudioFilter
: Filter for obfuscating audio.void
setDeleteSource(Boolean newDeleteSource)
Setter fordeleteSource
: Delete source file when finished.void
setFfmpeg(File newFfmpeg)
Setter forffmpeg
: Executable file for ffmpeg.FfmpegCensor
setVerbose(Boolean newVerbose)
Setter forverbose
: Whether to output intervals and ffmpeg command line arguments to stderr or not.MediaThread
start(String sourceType, File source, List<Double> boundaries, File destination)
Starts censoring.boolean
typeSupported(String sourceType)
Determines whether this censor supports censoring of media of the given type.
-
-
-
Method Detail
-
getFfmpeg
public File getFfmpeg()
Getter forffmpeg
: Executable file for ffmpeg.- Returns:
- Executable file for ffmpeg.
-
setFfmpeg
public void setFfmpeg(File newFfmpeg)
Setter forffmpeg
: Executable file for ffmpeg.- Parameters:
newFfmpeg
- Executable file for ffmpeg.
-
getAudioFilter
public String getAudioFilter()
Getter foraudioFilter
: Filter for obfuscating audio.- Returns:
- Filter for obfuscating audio. Default is "lowpass=f=80";
-
setAudioFilter
public void setAudioFilter(String newAudioFilter)
Setter foraudioFilter
: Filter for obfuscating audio.- Parameters:
newAudioFilter
- Filter for obfuscating audio.
-
getDeleteSource
public Boolean getDeleteSource()
Getter fordeleteSource
: Delete source file when finished.- Returns:
- Delete source file when finished.
-
setDeleteSource
public void setDeleteSource(Boolean newDeleteSource)
Setter fordeleteSource
: Delete source file when finished.- Parameters:
newDeleteSource
- Delete source file when finished.
-
getVerbose
public Boolean getVerbose()
Getter forverbose
: Whether to output intervals and ffmpeg command line arguments to stderr or not.- Returns:
- Whether to output intervals and ffmpeg command line arguments to stderr or not.
-
setVerbose
public FfmpegCensor setVerbose(Boolean newVerbose)
Setter forverbose
: Whether to output intervals and ffmpeg command line arguments to stderr or not.- Parameters:
newVerbose
- Whether to output intervals and ffmpeg command line arguments to stderr or not.
-
configure
public 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.
- Specified by:
configure
in interfaceMediaCensor
- 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
public boolean typeSupported(String sourceType) throws MediaException
Determines whether this censor supports censoring of media of the given type.- Specified by:
typeSupported
in interfaceMediaCensor
- 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
public 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 intevals (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.
- Specified by:
start
in interfaceMediaCensor
- 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.
-
-