moviepy.video.io.ffmpeg_reader.FFmpegInfosParser#

class moviepy.video.io.ffmpeg_reader.FFmpegInfosParser(infos, filename, fps_source='fps', check_duration=True, decode_file=False)[source]#

Finite state ffmpeg -i command option file information parser. Is designed to parse the output fast, in one loop. Iterates line by line of the ffmpeg -i <filename> [-f null -] command output changing the internal state of the parser.

Parameters:
  • filename -- Name of the file parsed, only used to raise accurate error messages.

  • infos -- Information returned by FFmpeg.

  • fps_source -- Indicates what source data will be preferably used to retrieve fps data.

  • check_duration -- Enable or disable the parsing of the duration of the file. Useful to skip the duration check, for example, for images.

  • decode_file -- Indicates if the whole file has been decoded. The duration parsing strategy will differ depending on this argument.

parse()[source]#

Parses the information returned by FFmpeg in stderr executing their binary for a file with -i option and returns a dictionary with all data needed by MoviePy.

parse_audio_stream_data(line)[source]#

Parses data from "Stream ... Audio" line.

parse_data_by_stream_type(stream_type, line)[source]#

Parses data from "Stream ... {stream_type}" line.

parse_duration(line)[source]#

Parse the duration from the line that outputs the duration of the container.

parse_fps(line)[source]#

Parses number of FPS from a line of the ffmpeg -i command output.

parse_metadata_field_value(line)[source]#

Returns a tuple with a metadata field-value pair given a ffmpeg -i command output line.

parse_tbr(line)[source]#

Parses number of TBS from a line of the ffmpeg -i command output.

parse_video_stream_data(line)[source]#

Parses data from "Stream ... Video" line.

video_metadata_type_casting(field, value)[source]#

Cast needed video metadata fields to other types than the default str.