Skip to end of metadata
Go to start of metadata
Contents Summary
 

This feature is supported by version 19.1 or greater.

Since version 19.3, the Matroska file format also supports the hierarchical metadata arrangement (as described in this article)

The code sample in below examples uses some methods defined in Working with Common Utilities.

 

Handling Metadata in MKV videos using GroupDocs.Metadata API

Getting MKV Format Metadata

The API allows getting MKV file format's metadata, the following steps are needed to be followed:

  • Initialize MatroskaFormat

  • Get metadata property e.g DocType using MatroskaFormat.getEbmlHeader().getDocType()

Following code snippet shows how to get metadata from the MKV file format.

Getting Matroska Segment Info

The API allows getting Matroska Segment Info, the following steps are needed to be followed:

  • Initialize MatroskaFormat

  • Loop through MatroskaFormat.getSegments() to get MatroskaSegmentInfoMetadata 

  • Get segment info e.g DateUtc using MatroskaSegmentInfoMetadata.getDateUtc()

Following code snippet shows how to get Matroska Segment Info.

Getting Matroska Tag Metadata

The API allows getting Matroska Tag Metadata, the following steps are needed to be followed:

  • Initialize MatroskaFormat

  • Loop through MatroskaFormat.getTags() to get MatroskaTagMetadata 

  • Get Matroska Tag Metadata  e.g TargetType using MatroskaTagMetadata.getTargetType()

Following code snippet shows how to get Matroska Tag Metadata.

Getting Matroska Track Metadata

The API allows getting Matroska Track Metadata, the following steps are needed to be followed:

  • Initialize MatroskaFormat

  • Loop through MatroskaFormat.getTracks() to get MatroskaTrackMetadata 

  • Get Matroska Track Metadata e.g CodecId using MatroskaTrackMetadata.getCodecId()
  • Get audio track metadata using  MatroskaTrackMetadata instance of MatroskaAudioTrackMetadata

  • Get video track metadata using  MatroskaTrackMetadata instance of MatroskaVideoTrackMetadata

Following code snippet shows how to get Matroska Track Metadata.

Get Subtitles Stored in an MKV Video

This feature is supported by version 19.4 or greater.

Since version 19.4,The API allows reading all subtitles stored in an MKV video, the following steps are needed to be followed:

  • Initialize MatroskaFormat

  • Loop through MatroskaFormat.getSubtitleTracks() to get MatroskaSubtitleTrackMetadata
  • Get Matroska Subtitles Metadata e.g MatroskaSubtitle using MatroskaSubtitleTrackMetadata.getSubtitles()

Following code snippet shows how to read subtitles metadata from the MKV file format.

Download Sample Files

You can download sample files used in this article.

sample.mkv

Following is the path of sample files used in code sample:

Labels
  • No labels