Wiki

Clone wiki

Yamdi / Home

Yamdi

Yamdi is a Python wrapper around the command line tool yamdi (github.com/ioppermann/yamdi). You’ll need yamdi installed in order for the package to be of any use. If you are on OSX I recommend using homebrew (brew install yamdi).

The Yamdi command line tool expects to receive a path to an flv file and will return XML file of the extracted metadata that we then wrap in a Python object and use to expose the metadata.

Current package version only supports the reading of metadata. The command line tool also supports the writing of the metadata into a new .flv file but this is not yet supported in this package.

Tested under Python 2.6.1

Requirements

  • BeautifulSoup > pip install BeautifulSoup
  • Yamdi > brew install yamdi

Usage

>>> from yamdi import Yamdi
>>> flvmeta = Yamdi(flv_path="/path/to/flv")
>>> flvmeta.duration
10.4
>>> for keyframe in flvmeta.key_frames:
...    keyframe.time # gets time value
...    keyframe.file_position # gets position in file with respect to a time

Supported methods

MethodReturn type
durationfloat, in seconds
has_keyframesboolean
has_videoboolean
has_audioboolean
has_metadataboolean
has_cue_pointsboolean
can_seek_to_endboolean
audio_codec_idinteger
audio_sample_rateinteger
audio_data_rateinteger
audio_sample_sizeinteger
audio_delayfloat, in seconds
stereoboolean
video_codec_idinteger
frame_ratefloat, in seconds
video_data_rateinteger
heightinteger
widthinteger
data_sizeinteger
audio_sizeinteger
video_sizeinteger
file_sizeinteger
last_timestampfloat, in seconds
last_video_frame_timestampfloat, in seconds
last_key_frame_timestampfloat, in seconds
last_key_frame_locationinteger

key_frames Array of key frame data, each item contains the following

  • time - float, in seconds
  • file_position - integer

Inspired by Yamdi on ruby by @peregrinator

Have fun!

Updated