Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SPXERR_GSTREAMER_NOT_FOUND_ERROR when using mp3 file with Microsoft.CognitiveServices.Speech

I have this piece of code throwing the wrror in the title:

using (var audioInput = AudioConfig.FromStreamInput(new PullAudioInputStream(new BinaryAudioStreamReader(new BinaryReader(File.OpenRead(audioFile))), AudioStreamFormat.GetCompressedFormat(AudioStreamContainerFormat.MP3))))
using (var recognizer = new SpeechRecognizer(config, sourceLanguageConfig, audioInput))

audioFile is the path to mp3 file with audio to transcribe.

I have installed the latest GStreamer gstreamer-1.0-msvc-x86_64-1.17.2.msi for Windows and added it to the User's PATH and set GSTREAMER_ROOT_X86. That did not work.

In the docs here https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/how-to-use-codec-compressed-audio-input-streams?tabs=debian&pivots=programming-language-csharp

Handling compressed audio is implemented using GStreamer. For licensing reasons GStreamer binaries are not compiled and linked with the Speech SDK. Developers need to install several dependencies and plugins, see Installing on Windows. Gstreamer binaries need to be in the system path, so that the speech SDK can load gstreamer binaries during runtime. If speech SDK is able to find libgstreamer-1.0-0.dll during runtime it means the gstreamer binaries are in the system path.

It says it will look for libgstreamer-1.0-0.dll which is no longer included in the latest version (1.17.2) so I went back to gstreamer-1.0-x86-1.14.1 which does have the required dll, but still getting the same error.

From Visual Studio 2019 console I can invoke exe files included in that folder so I know the PATH is set correctly.

Anyone has an idea what's missing?

like image 717
Artur Kędzior Avatar asked Sep 13 '25 03:09

Artur Kędzior


2 Answers

the way i fixed this... (similar to Artur Kędzior)

use version 1.14.5 of Gstreamer https://gstreamer.freedesktop.org/pkg/windows/1.14.5/gstreamer-1.0-x86_64-1.14.5.msi - complete setup

use version 1.13 of Microsoft.CognitiveServices.Speech (Nuget package)

Go to environment variables on your pc and add to the User variable called path the following C:\gstreamer\1.0\x86_64\bin

then add a system variable called "GSTREAMER_ROOT_X86_64" (without the quotes) and the value to "C:\gstreamer\1.0\x86_64"

you may need to reboot if still having issues. but this is now working for me.

like image 99
Daniel Comer Avatar answered Sep 15 '25 18:09

Daniel Comer


Got help with it here https://github.com/Azure-Samples/cognitive-services-speech-sdk/issues/764

Basically:

  1. Do not use the latest version of Gstreamer
  2. Use this one https://gstreamer.freedesktop.org/pkg/windows/1.14.5/gstreamer-1.0-x86_64-1.14.5.msi
  3. Set PATH to bin folder (C:\gstreamer\1.0\x86_64\bin)
  4. Set GSTREAMER_ROOT_X86_64 variable (C:\gstreamer\1.0\x86_64)
  5. Reboot the machine
  6. Set Visual Studio build configuration to x64
like image 36
Artur Kędzior Avatar answered Sep 15 '25 18:09

Artur Kędzior