drewnoakes / metadata-extractor

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Apache License 2.0
2.59k stars 480 forks source link

Support WebM file format #582

Open vibbix opened 2 years ago

vibbix commented 2 years ago

We are looking to read metadata from a WebM file. WebM is a subset of the MKV standard and is documented here: https://www.webmproject.org/docs/container/

Examples are included here: https://www.webmfiles.org/demo-files/ https://commons.wikimedia.org/wiki/File:Volcano_Lava_Sample.webm

nikolajovickg commented 2 months ago

I've created some EBML parser inside metadata-extractor for extracting metadata from matroška and webm. I'll need to tidy up the code and decide which metadata to extract and which to ignore. Don't know whether to recursively parse all the data, I think seek locations could be ignored, and some other things. For MVP I think audio/video codecs, doctype, mux and writing program names, framerate, duration, resolution should suffice. Perhaps, some user tags too but due to nested and repetitive structure I don't know how to name them (should I flatten them with some suffix attached or something?) Some derivative metadata is needed to be useful, I think (such as frameRate and duration which is derived from several fields) The crude output for volcano webm sample is:


Id: EBML_READ_VERSION size: 1 value 1
Id: EBML_MAX_ID_LENGTH size: 1 value 4
Id: EBML_MAX_SIZE_LENGTH size: 1 value 8
Id: DOCTYPE size: 4 value webm
Id: DOCTYPE_VERSION size: 1 value 2
Id: DOCTYPE_READ_VERSION size: 1 value 2
Id: SEGMENT size: 53054851 value MASTER: 
--Id: SEEK_HEAD size: 46 value MASTER: 
----Id: SEEK size: 11 value MASTER: 
------Id: SEEK_ID size: 4 value 0x1549A966
------Id: SEEK_POSITION size: 1 value 223
----Id: SEEK size: 12 value MASTER: 
------Id: SEEK_ID size: 4 value 0x1654AE6B
------Id: SEEK_POSITION size: 2 value 300
----Id: SEEK size: 14 value MASTER: 
------Id: SEEK_ID size: 4 value 0x1C53BB6B
------Id: SEEK_POSITION size: 4 value 53053999
--Id: VOID size: 162 value VOID
--Id: SEGMENT_INFO size: 65 value MASTER: 
----Id: TIMESTAMP_SCALE size: 3 value 1000000
----Id: MUXING_APP size: 11 value Lavf54.20.4
----Id: WRITING_APP size: 11 value Lavf54.20.4
----Id: SEGMENT_UUID size: 16 value 0xFFFFFFFFFDFFDFFF
----Id: DURATION size: 8 value 165468.0
--Id: TRACKS size: 4091 value MASTER: 
----Id: TRACK_ENTRY size: 64 value MASTER: 
------Id: TRACK_NUMBER size: 1 value 1
------Id: TRACK_UID size: 1 value 1
------Id: 0x9C [ unknown ] size: 1 value null 156
------Id: 0x22B59C [ unknown ] size: 3 value null 2274716
------Id: CODEC_ID size: 5 value V_VP8
------Id: TRACK_TYPE size: 1 value 1
------Id: 0x23E383 [ unknown ] size: 2 value null 2352003
------Id: 0xE0 [ unknown ] size: 22 value null 224
----Id: TRACK_ENTRY size: 4009 value MASTER: 
------Id: TRACK_NUMBER size: 1 value 2
------Id: TRACK_UID size: 1 value 2
------Id: 0x9C [ unknown ] size: 1 value null 156
------Id: 0x22B59C [ unknown ] size: 3 value null 2274716
------Id: CODEC_ID size: 8 value A_VORBIS
------Id: TRACK_TYPE size: 1 value 2
------Id: 0xE1 [ unknown ] size: 17 value null 225
------Id: 0x63A2 [ unknown ] size: 3949 value null 25506
--Id: CLUSTER size: 477741 value MASTER: `