i6_core.audio.ffmpeg

class i6_core.audio.ffmpeg.BlissFfmpegJob(*args, **kwargs)

Applies an FFMPEG audio filter to all recordings of a bliss corpus. This Job is extremely generic, as any valid audio option/filter string will work. Please consider using more specific jobs that use this Job as super class, see e.g. BlissChangeEncodingJob

WARNING:
  • This job assumes that file names of individual recordings are unique across the whole corpus.

  • Do not change the duration of the audio files when you have multiple segments per audio, as the segment information will be incorrect afterwards.

Typical applications:

Changing Audio Format/Encoding

  • specify in output_format what container you want to use. If the filter string is empty (“”), ffmepg will automatically use a default encoding option

  • specify specific encoding with -c:a <codec>. For a list of available codecs and their options see https://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders

  • specify a fixed bitrate with -b:a <bit_rate>, e.g. 64k. Variable bitrate options depend on the used encoder, refer to the online documentation in this case

  • specify a sample rate with -ar <sample_rate>. FFMPEG will do proper resampling, so the speed of the audio is NOT changed.

Changing Channel Layout

  • for detailed informations see https://trac.ffmpeg.org/wiki/AudioChannelManipulation

  • convert to mono -ac 1

  • selecting a specific audio channel: -filter_complex [0:a]channelsplit=channel_layout=stereo:channels=FR[right] -map [right] For a list of channels/layouts use ffmpeg -layouts

Simple Filter Syntax

For a list of available filters see: https://ffmpeg.org/ffmpeg-filters.html

-af <filter_name>=<first_param>=<first_param_value>:<second_param>=<second_param_value>

Complex Filter Syntax

-filter_complex [<input>]<simple_syntax>[<output>];[<input>]<simple_syntax>[<output>];…

Inputs and outputs can be namend arbitrarily, but the default stream 0 audio can be accessed with [0:a]

The output stream that should be written into the audio is defined with -map [<output_stream>]

IMPORTANT! Do not forget to add and escape additional quotation marks correctly for parameters to`-af` or -filter_complex

Parameters:
  • corpus_file – bliss corpus

  • ffmpeg_options – list of additional ffmpeg parameters

  • recover_duration – if the filter changes the duration of the audio, set to True

  • output_format – output file ending to determine container format (without dot)

  • ffmpeg_binary – path to a ffmpeg binary, uses system “ffmpeg” if None

  • hash_binary – In some cases it might be required to work with a specific ffmpeg version, in which case the binary needs to be hashed

  • ffmpeg_input_options – list of ffmpeg parameters thare are applied for reading the input files

classmethod hash(kwargs)
Parameters:

parsed_args (dict[str]) –

Returns:

hash for job given the arguments

Return type:

str

run()
run_recover_duration()

Open all files with “soundfile” and extract the length information

Returns:

tasks()
Returns:

yields Task’s

Return type:

list[sisyphus.task.Task]