public class MatroskaRootPackage extends RootMetadataPackage
Represents the root package allowing working with metadata in a Matroska video.
Learn more
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()); } } }
Modifier and Type | Method and Description |
---|---|
MatroskaPackage |
getMatroskaPackage()
Gets the Matroska metadata package.
|
getFileType, sanitize
addProperties, contains, findProperties, get_Item, getCount, getKeys, getKnowPropertyDescriptors, getMetadataType, getPropertyDescriptors, iterator, removeProperties, setProperties, updateProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public final MatroskaPackage getMatroskaPackage()
Gets the Matroska metadata package.