Reputation: 123
I am using MediaInfo.dll with Wrapper-Class to check Video-Files for Audio-Codecs.
Can someone tell me how I can check COUNT of the Audio-Streams of the File?
string pfad = Console.ReadLine();
string[] verzeichnisse = Directory.GetDirectories(pfad);
foreach (string verzeichnis in verzeichnisse)
{
string[] dateien = Directory.GetFiles(verzeichnis);
foreach (string datei in dateien)
{
if(datei.ToLower().Contains(".mkv") || datei.ToLower().Contains(".avi") || datei.ToLower().Contains(".mp4"))
{
var mediaInfo = new MediaInfo();
mediaInfo.Open(datei);
// HERE I WANT CHECK FIRST HOW MANY AUDIO-STREAMS THERE ARE
// ???
var audioStream1 = mediaInfo.Get(StreamKind.Audio, 0, "Format");
var audioStream2 = mediaInfo.Get(StreamKind.Audio, 1, "Format");
mediaInfo.Close();
}
}
}
Upvotes: 3
Views: 1085
Reputation: 459
You can find all the MediaInfo properties here https://staxrip2.readthedocs.io/en/latest/mediainfo.html
A few of them don't work, I don't know if it's a bug in the C# wrapper.
In your case, you can count the video, audio and subtitle streams respectively with:
mediaInfo.Get(StreamKind.Video, 0, "StreamCount");
mediaInfo.Get(StreamKind.Audio, 0, "StreamCount");
mediaInfo.Get(StreamKind.Text, 0, "StreamCount");
Upvotes: 1
Reputation: 1207
how I can check COUNT of the Audio-Streams of the File?
mediaInfo.Count_Get(StreamKind.Audio);
You may check the MediaInfo C# example for more examples.
Another example (you can find it with the linked example) :
mediaInfo.Get(StreamKind.Audio, 0, "Language");
Jérôme, developer of MediaInfo.
Upvotes: 1