Linked media metadata

Reading media metadata

Since ELAN annotation files are based on annotating multimedia (audio and/or video), EAF annotation files (should) always have linked media files in their file contents. Sometimes it is useful to access the paths to and types of these files as metadata alongside annotations. This can be done using read_media(), which simply outputs a data frame with the associated media file(s) with paths and file types listed in long format:

library(readelan)

eaf_file <- system.file("extdata", 
                        "example.eaf", 
                        package = "readelan")

read_media(eaf_file)
     filename item          attribute                             value
1 example.eaf    1          MEDIA_URL file:///Users/user01/video_01.mp4
2 example.eaf    1          MIME_TYPE                         video/mp4
3 example.eaf    1 RELATIVE_MEDIA_URL                    ./video_01.mp4
4 example.eaf    2          MEDIA_URL file:///Users/user01/video_02.mp4
5 example.eaf    2          MIME_TYPE                         video/mp4
6 example.eaf    2 RELATIVE_MEDIA_URL                    ./video_02.mp4
7 example.eaf    3          MEDIA_URL file:///Users/user01/audio_02.mp3
8 example.eaf    3          MIME_TYPE                           audio/*
9 example.eaf    3 RELATIVE_MEDIA_URL                    ./audio_02.mp3

The item column is an identifier for an individual linked file in the EAF file, thus there are three linked media files (two videos; one audio) in this example.

Additional arguments

Writing full paths

The full_path argument simply determines whether the full file path input should be written to the output data frame as the filename (if TRUE; e.g., “/path/to/elan_file.eaf”), or whether it should be shortened to the base name only (if FALSE, the default; e.g., “elan_file.eaf”).

Progress bar

If progress is set to TRUE, a progress bar will be printed to the console as files are read. This is mostly useful when reading multiple files that take some time to complete (see Multiple files).