I am trying to get video metadata using exoplayer without playback as mentioned in document
when i try to run i cannot get list of audio track and subtitle track from local video file.
MediaItem mediaItem = MediaItem.fromUri(videoUrl);
ListenableFuture<TrackGroupArray> trackGroupsFuture = MetadataRetriever.retrieveMetadata(this, mediaItem);
Futures.addCallback(trackGroupsFuture, new FutureCallback<TrackGroupArray>() {
@Override
public void onSuccess(TrackGroupArray trackGroups) {
for(int i = 0; i < trackGroups.length; i++){
String format = trackGroups.get(i).getFormat(0).sampleMimeType;
String lang = trackGroups.get(i).getFormat(0).language;
String id = trackGroups.get(i).getFormat(0).id;
if(format.contains("audio") && id != null && lang != null){
Log.d(TAG, "onSuccess: " + lang + " " + id);
}
}
}
@Override
public void onFailure(Throwable t) {
//handleFailure(t);
Log.d(TAG, "onFailure: " + t);
}
}, executor);
can someone help. How can I get list of tracks available in a video.
here is a sample video link https://storage.googleapis.com/jlplayer/Dolittle.mkv
for example the above sample video contains a english subtitle a hindi audio track and english audio track. So how do i extract those track ?
i used https://mediaarea.net/en/MediaInfo and used below method to get video information.
mediaInfo.get("sample.mp4", MediaInfo.StreamKind.VIDEO, 0, "Format", MediaInfo.InfoKind.TEXT, MediaInfo.InfoKind.NAME)
and full solution to this question is listed in this Unable to extract parameter from video using MediaInfo