Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample rate of the given file is not supported Format #223

Closed
charliefr opened this issue May 19, 2024 · 0 comments
Closed

Sample rate of the given file is not supported Format #223

charliefr opened this issue May 19, 2024 · 0 comments

Comments

@charliefr
Copy link

Thanks for the attention, I'm using the example in the README, referencing the package version <PackageReference Include="SoundFingerprinting" Version="10.3.1" />,Windows 10 system, .net 9.0.100-preview.3. 24204.13

The sample code is as follows:

    // create fingerprints
    var avHashes = await FingerprintCommandBuilder.Instance
                                .BuildFingerprintCommand()
                                .From(file)
                                .UsingServices(audioService)
                                .Hash();

The exception is thrown as follows:

System.ArgumentException: Sample rate of the given file is not supported Format: SampleRate $1650422383, Channels $27233, BitsPerSample $28531, Length $221411. Supported sample rates 5512,8000,11025,16000,22050,44100,48000,96000. Submit a github request if you need a different sample rate to be supported.
   at SoundFingerprinting.Audio.SoundFingerprintingAudioService.CheckInputFileFormat(WaveFormat format, Double startsAt)
   at SoundFingerprinting.Audio.SoundFingerprintingAudioService.ReadMonoSamplesFromFile(String pathToSourceFile, Int32 sampleRate, Double seconds, Double startAt)
   at SoundFingerprinting.Command.FingerprintCommand.<>c__DisplayClass13_0.<From>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Program.<Main>$(String[] args) in A:\learn-soundfingerprinting\sfp\Program.cs:line 9
   at Program.<Main>(String[] args)

This is the audio file information output by ffprobe,it shows that my audio file is 44100 Hz

Input #0, mp3, from 'video_2024-02-22_12-25-14.mp3':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.3.100
  Duration: 00:00:13.82, start: 0.025057, bitrate: 128 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc60.3.

image

this is my file :

sample.zip

@charliefr charliefr closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant