ffprobes3 package

Classes and methods

Python3 wrapper for ffprobe command line tool. ffprobe must exist in the path.

class ffprobes3.FFProbes3(video_file)[source]

FFProbes3 wraps the ffprobe command and pulls the data into an object. For example: metadata = FFProbes3(“this_is_a_multimedia_file.mp4’)

class ffprobes3.FFStream(data_lines)[source]

An object representation of an individual stream in a multimedia file.

FFStream objects are created from FFProbes3 as it reads the file. The constructor creates a dynamic list of attributes, based on the “xx = yy” format of ffprobe’s text output.

For example, two lines of ffprobe’s output like these:

avg_frame_rate=0/0
time_base=1/48000

will generate these FFStream’s attributes:

avg_frame_rate
time_base

with these values:

0/0
1/48000
Parameters:data_lines (list) – list of lines from the output obtained from ffprobe
bit_rate()[source]

Returns bit_rate as an integer in bps

codec()[source]

Returns a string representation of the stream codec.

codec_description()[source]

Returns a long representation of the stream codec.

codec_tag()[source]

Returns a short representative tag of the stream codec.

duration_seconds()[source]

Returns the runtime duration of the video stream as a floating point number of seconds. Returns 0.0 if not a video stream.

frame_size()[source]

Returns the pixel frame size as an integer tuple (width,height) if the stream is a video stream. Returns None if it is not a video stream.

frames()[source]

Returns the length of a video stream in frames. Returns 0 if not a video stream.

get_avg_frame_rate()[source]

Returns the average fps value for the stream

get_r_frame_rate()[source]

Returns the fps value for the stream

is_audio()[source]

Is this stream labelled as an audio stream?

is_subtitle()[source]

Is the stream labelled as a subtitle stream.

is_video()[source]

Is the stream labelled as a video stream.

language()[source]

Returns language tag of stream. e.g. eng

pixel_format()[source]

Returns a string representing the pixel format of the video stream. e.g. yuv420p. Returns none is it is not a video stream.