From 9df2ee2ead4ce23d06351a6cdb4fea588f79e429 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Thu, 19 Jan 2023 17:10:24 +0100 Subject: Workaround for the Microsoft’s bug in their MP3 decoder MFT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples/WhisperDesktop/TranscribeDlg.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Examples') diff --git a/Examples/WhisperDesktop/TranscribeDlg.cpp b/Examples/WhisperDesktop/TranscribeDlg.cpp index cd23c93..b99e98a 100644 --- a/Examples/WhisperDesktop/TranscribeDlg.cpp +++ b/Examples/WhisperDesktop/TranscribeDlg.cpp @@ -298,7 +298,6 @@ HRESULT TranscribeDlg::transcribe() CComPtr reader; CHECK_EX( appState.mediaFoundation->openAudioFile( transcribeArgs.pathMedia, false, &reader ) ); - CHECK_EX( reader->getDuration( transcribeArgs.mediaDuration ) ); const eOutputFormat format = transcribeArgs.format; CAtlFile outputFile; @@ -324,6 +323,11 @@ HRESULT TranscribeDlg::transcribe() // Run the transcribe CHECK_EX( context->runStreamed( fullParams, progressSink, reader ) ); + // Once finished, query duration of the audio. + // The duration before the processing is sometimes different, by 20 seconds for the file in that issue: + // https://github.com/Const-me/Whisper/issues/4 + CHECK_EX( reader->getDuration( transcribeArgs.mediaDuration ) ); + context->timingsPrint(); if( format == eOutputFormat::None ) -- cgit v1.2.3