FFMPEG tools¶
Miscellaneous bindings to ffmpeg.
-
moviepy.video.io.ffmpeg_tools.
ffmpeg_extract_audio
(inputfile, outputfile, bitrate=3000, fps=44100, logger='bar')[source]¶ Extract the sound from a video file and save it in
outputfile
.- Parameters:
- inputfilestr
The path to the file from which the audio will be extracted.
- outputfilestr
The path to the file to which the audio will be stored.
- bitrateint, optional
Bitrate for the new audio file.
- fpsint, optional
Frame rate for the new audio file.
-
moviepy.video.io.ffmpeg_tools.
ffmpeg_extract_subclip
(inputfile, start_time, end_time, outputfile=None, logger='bar')[source]¶ Makes a new video file playing video file between two times.
- Parameters:
- inputfilestr
Path to the file from which the subclip will be extracted.
- start_timefloat
Moment of the input clip that marks the start of the produced subclip.
- end_timefloat
Moment of the input clip that marks the end of the produced subclip.
- outputfilestr, optional
Path to the output file. Defaults to
<inputfile_name>SUB<start_time>_<end_time><ext>
.
-
moviepy.video.io.ffmpeg_tools.
ffmpeg_merge_video_audio
(videofile, audiofile, outputfile, video_codec='copy', audio_codec='copy', logger='bar')[source]¶ Merges video file and audio file into one movie file.
- Parameters:
- videofilestr
Path to the video file used in the merge.
- audiofilestr
Path to the audio file used in the merge.
- outputfilestr
Path to the output file.
- video_codecstr, optional
Video codec used by FFmpeg in the merge.
- audio_codecstr, optional
Audio codec used by FFmpeg in the merge.
-
moviepy.video.io.ffmpeg_tools.
ffmpeg_resize
(inputfile, outputfile, size, logger='bar')[source]¶ Resizes a file to new size and write the result in another.
- Parameters:
- inputfilestr
Path to the file to be resized.
- outputfilestr
Path to the output file.
- sizelist or tuple
New size in format
[width, height]
for the output file.
-
moviepy.video.io.ffmpeg_tools.
ffmpeg_stabilize_video
(inputfile, outputfile=None, output_dir='', overwrite_file=True, logger='bar')[source]¶ Stabilizes
filename
and write the result tooutput
.- Parameters:
- inputfilestr
The name of the shaky video.
- outputfilestr, optional
The name of new stabilized video. Defaults to appending ‘_stabilized’ to the input file name.
- output_dirstr, optional
The directory to place the output video in. Defaults to the current working directory.
- overwrite_filebool, optional
If
outputfile
already exists inoutput_dir
, then overwriteoutputfile
Defaults to True.