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

.netcore 6 console app on mac - "Specified method is not supported" #197

Closed
davidbelle opened this issue Dec 8, 2022 · 7 comments
Closed

Comments

@davidbelle
Copy link

davidbelle commented Dec 8, 2022

When compiling the example found for fingerprinting video, an exception "Specified method is not supported" is thrown.

To Reproduce

public class Playground
	{
        // save fingerprints in Emy Community Edition https://hub.docker.com/repository/docker/addictedcs/soundfingerprinting.emy
        private readonly IModelService modelService = EmyModelService.NewInstance("localhost", 3399);
        //private readonly IModelService modelService = new InMemoryModelService();

        // use FFmpeg to extract samples and frames from files: https://github.com/AddictedCS/soundfingerprinting/wiki/Audio-Services
        private readonly IMediaService mediaService = new FFmpegAudioService();

        public async Task AddClip(string location)
        {


            Console.WriteLine("Add Clip " +location);
            var avHashes = await FingerprintCommandBuilder.Instance
                .BuildFingerprintCommand()
                .From(location, MediaType.Video)
                .UsingServices(mediaService)
            .Hash();
            Console.WriteLine("added, create track");

            var track = new TrackInfo("1234", "BWM", "", MediaType.Video);
            Console.WriteLine("track has been created, now to insert it");
            modelService.Insert(track, avHashes);
            Console.WriteLine("Track has been inserted into model");
        }
}

Program.cs

Playground playground = new Playground();
await playground.AddClip("file.mp4");

Exception is thrown on the " var avHashes = await FingerprintCommandBuilder.Instance...." line.

Exception

System.NotSupportedException: "Specified method is not supported."
  at FFmpeg.AutoGen.Bindings.DynamicallyLoaded.DynamicallyLoadedBindings.<>c.<Initialize>b__6_1428()\n   at SoundFingerprinting.Emy.FFmpeg.Demuxer.OpenInputFile(String file)\n   at SoundFingerprinting.Emy.FFmpeg.Demuxer..ctor(String file, MediaType mediaType, CancellationToken cancellationToken)\n   at SoundFingerprinting.Emy.AudioVideo.Data.FFmpegDataService.<ReadAVTrack>d__4.MoveNext()\n   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\n   at SoundFingerprinting.Emy.AudioVideo.Data.FFmpegDataService.ReadTrack(String file, MediaType mediaType, Double seconds, AVTrackReadConfiguration configuration)\n   at SoundFingerprinting.Emy.FFmpegAudioService.ReadFramesFromFile(String pathToFile, VideoTrackReadConfiguration configuration, Double seconds, Double startsAt)\n   at SoundFingerprinting.Command.FingerprintCommand.<>c__DisplayClass13_0.<From>b__0()\n   at System.Threading.Tasks.Task`1.InnerInvoke()\n   at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)\n   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)\n--- End of stack trace from previous location ---\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)\n   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)\n--- End of stack trace from previous location ---\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\n   at Newsfinder.Playground.<AddClip>d__3.MoveNext() in Playground.cs:line 35\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\n   at Program.<<Main>$>d__0.MoveNext() in Program.cs:47

I have the community edition of Envy running in docker, but I also tried InMemoryModelService instead and have the same issue.

Thanks :)

@AddictedCS
Copy link
Owner

What is the output of the fmpeg -version command in your terminal?

@davidbelle
Copy link
Author

ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
built with Apple clang version 14.0.0 (clang-1400.0.29.202)
configuration: --prefix=/usr/local/Cellar/ffmpeg/5.1.2_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil      57. 28.100 / 57. 28.100
libavcodec     59. 37.100 / 59. 37.100
libavformat    59. 27.100 / 59. 27.100
libavdevice    59.  7.100 / 59.  7.100
libavfilter     8. 44.100 /  8. 44.100
libswscale      6.  7.100 /  6.  7.100
libswresample   4.  7.100 /  4.  7.100
libpostproc    56.  6.100 / 56.  6.100

@AddictedCS
Copy link
Owner

FFmpeg 5 is not supported yet.
Please install ffmpeg@4.

Remove previously installed ffmpeg.

brew uninstall ffmpeg

and then install v4

brew install ffmpeg@4

@davidbelle
Copy link
Author

Thanks. I've removed 5 and installed 4 as suggested but still get the same error.

ffmpeg version 4.2.2-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.16)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
libavutil      56. 31.100 / 56. 31.100
libavcodec     58. 54.100 / 58. 54.100
libavformat    58. 29.100 / 58. 29.100
libavdevice    58.  8.100 / 58.  8.100
libavfilter     7. 57.100 /  7. 57.100
libswscale      5.  5.100 /  5.  5.100
libswresample   3.  5.100 /  3.  5.100
libpostproc    55.  5.100 / 55.  5.100

@AddictedCS
Copy link
Owner

AddictedCS commented Dec 9, 2022

Unfortunately, brew does not link the contents of/usr/local/opt/ffmpeg@4/lib/ to /usr/local/lib, as it considers it to be just a keg (whatever that means, installing older versions does not link it automatically), so you can either link it manually, or wait until I add a probe path to v8.18.0.
The following command will link FFmpeg libraries to /usr/local/lib such that they are available in the executable probing

ln -s /usr/local/opt/ffmpeg@4/lib/* /usr/local/lib

@davidbelle
Copy link
Author

I dunno what that means either but hey, it worked! Thanks :)

@Bloos
Copy link

Bloos commented Aug 15, 2023

same thing happened to me on a fedora system. Luckily I was using Docker anyway and could switch over to a ubuntu image

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

3 participants