Frage

Ich versuche, Mediendateiendauer mit DirectStow zu erhalten.Ich benutze folgendem Code (C #): generasacodicetagpre.

, um die Mediendateidauer in Sekunden zu erhalten.Wenn ich jedoch versuche, 3-4 Minuten MP3-Dateien zu öffnen, wird die Spurdauer von 11-12 Minuten.Ich habe auf mehreren Dateien ausprobiert und Effekt ist immer gleich.Was kann der Grund sein?

War es hilfreich?

Lösung

You normally use IMediaPosition interface (instead of IMediaSeeking) from the application side. Duration is reported always in seconds. However this is unlikely to make a difference, and what might make it is reading duration from ID3 tags instead, using Windows Media API, ID3 Tag Support.

Are there more reliable ways to get exact duration of media file with DirectShow API?

Windows Media Player plays MP3 files through Media Foundation, a non-DirectShow API, so you don't have an option here to expect or do exactly the same from DirectShow.

Andere Tipps

From the documentation:

Depending on the source format, the duration might not be exact. For example, if the source contains a variable bit-rate (VBR) stream, the method might return an estimated duration.

Are you using a VBR stream, by any chance?

You can try the same on a clean windows installation. It might be possible you have a codec(pack) installed which is buggy.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top