com.groupdocs.metadata.core

Interfaces

Classes

Exceptions

com.groupdocs.metadata.core

Class MatroskaRootPackage

  • All Implemented Interfaces:
    Iterable<MetadataProperty>


    public class MatroskaRootPackage
    extends RootMetadataPackage

    Represents the root package allowing working with metadata in a Matroska video.

    This example demonstrates how to extract subtitles from an MKV video.

    try (Metadata metadata = new Metadata(Constants.MkvWithSubtitles)) {
         MatroskaRootPackage root = metadata.getRootPackageGeneric();
         for (MatroskaSubtitleTrack subtitleTrack : root.getMatroskaPackage().getSubtitleTracks()) {
             System.out.println(subtitleTrack.getLanguageIetf() != null ? subtitleTrack.getLanguageIetf() : subtitleTrack.getLanguage());
             for (MatroskaSubtitle subtitle : subtitleTrack.getSubtitles()) {
                 System.out.println(String.format("Timecode=%s, Duration=%s", subtitle.getTimecode(), subtitle.getDuration()));
                 System.out.println(subtitle.getText());
             }
         }
     }
     
    • Method Detail

      • getMatroskaPackage

        public final MatroskaPackage getMatroskaPackage()

        Gets the Matroska metadata package.

        Returns:
        The Matroska metadata package.