Metadata

This file contains a Job for extracting the metadata from a user annotated file. The format is specific to the MLSS 2015, but may be easily adapted to your needs.

Metadata(*args, **kwargs) Job taking the metadata location anf video filename and produce metadata suitable for the movie composition object ClipsToMovie.
metadata_mogrifier(folder) Utility function transforming metadata stored in txt file into a format usable by Metadata usable one.
class livius.video.processing.jobs.meta.Metadata(*args, **kwargs)

Job taking the metadata location anf video filename and produce metadata suitable for the movie composition object ClipsToMovie.

The expected structure of the meta data is the following:

root of metadata
|- video_file_name_WE
   |- video_file_name_WE_metadata_input.json
   |- some_png_image.png

where WE stands for without extension. The meta will look for the files containing the relevant information under the root directory containing the meta data, and the video filename WE. It will look for on picture in PNG format and consider it as the introduction picture.

Runtime parameters

  • video_filename name of the video to process (mandatory, cached)
  • meta_location location of the meta data (mandatory, not cached)

Note

Some of the attributes of the final video are set by the ClipsToMovie job (such as the credit/epilog images, the background image, etc).

Metadata file format

As its name indicates the file video_file_name_WE_metadata_input.json is a json file containing the following fields:

  • speaker the name of the speaker
  • title the title of the talk
  • date in a string format (it will not be interpreted in any way)
  • video_begin (optional) indicates the beginning of the sequence in a moviePy format (eg. 00:00:57 for 57sec)
  • video_end (optional) indicates the end of the sequence in a moviePy format
__init__(*args, **kwargs)
Parameters:
  • video_filename (str) – video being processed (cached)
  • meta_location (str) – location of the meta information (not cached)
attributes_to_serialize = ['video_filename', 'intro_image_names', 'video_begin', 'video_end', 'title', 'speaker', 'date']

Cached input:

  • video_filename input video file
  • intro_image_names the name of the image shown in introduction
  • video_begin beginning of the video
  • video_end end of the video
  • title title of the talk
  • speaker speaker of the talk
  • date date of the talk (full string)

All the parameters read from the metadata file are considered as inputs to the Job. If we do otherwise (eg. cached outputs), then it might happen that the job is not properly flagged as dirty when some settings change (eg. adding an image file).

outputs_to_cache = []

Cached output:

livius.video.processing.jobs.meta.metadata_mogrifier(folder)

Utility function transforming metadata stored in txt file into a format usable by Metadata usable one.

This is just an example reading 2 files in a JSON format and creating the appropriate metadata input for the Metadata class.

It is possible to run directly this function by providing the location of the folder to parse, in the following way:

python -m livius.video.processing.jobs.meta some_folder