moviepy.audio.io.ffmpeg_audiowriter.FFMPEG_AudioWriter#

class moviepy.audio.io.ffmpeg_audiowriter.FFMPEG_AudioWriter(filename, fps_input, nbytes=2, nchannels=2, codec='libfdk_aac', bitrate=None, input_video=None, logfile=None, ffmpeg_params=None)[source]#

A class to write an AudioClip into an audio file.

Parameters:
  • filename -- Name of any video or audio file, like video.mp4 or sound.wav etc.

  • size -- Size (width,height) in pixels of the output video.

  • fps_input -- Frames per second of the input audio (given by the AudioClip being written down).

  • nbytes (int, optional) -- Number of bytes per sample. Default is 2 (16-bit audio).

  • nchannels (int, optional) -- Number of audio channels. Default is 2 (stereo).

  • codec (str, optional) -- The codec to use for the output. Default is libfdk_aac.

  • bitrate -- A string indicating the bitrate of the final video. Only relevant for codecs which accept a bitrate.

  • input_video (str, optional) -- Path to an input video file. If provided, the audio will be muxed with this video. If not provided, the output will be audio-only.

  • logfile (file-like object or None, optional) -- A file object where FFMPEG logs will be written. If None, logs are suppressed.

  • ffmpeg_params (list of str, optional) -- Additional FFMPEG command-line parameters to customize the output.

close()[source]#

Closes the writer, terminating the subprocess if is still alive.

write_frames(frames_array)[source]#

Send the audio frame (a chunck of AudioClip) to ffmpeg for writting