FFMpegCore icon indicating copy to clipboard operation
FFMpegCore copied to clipboard

find first frame where audio is above a threshold

Open djaus2 opened this issue 7 months ago • 1 comments

Looking for a way of noting the first frame in a video where the audio is above a threshold. Context is a start gun for an athletics event..

Some related suggeste code is:

ffmpeg -i video.mp4 -vn -filter:a volumedetect -f null -

Probably want something like that but in app rather than a separate app.

djaus2 avatar May 24 '25 10:05 djaus2

Tried this code to procress sound levels , 4 ways:

            string output = FFMpegArguments
                .FromFileInput("video.mp4")
                .WithArguments("-filter:a astats=metadata=1:reset=1 -f null -")
                .CaptureOutput()
                .ProcessSynchronously();
            string output2 =  FFMpegArguments
                .FromFileInput("video.mp4")
                .AddParameter("-filter:a", "astats=metadata=1:reset=1")
                .AddParameter("-f", "null")
                .OutputToPipe(new StreamPipeSink(Console.OpenStandardOutput()))
                .ProcessSynchronously();
            string output3 =  FFMpegArguments
                .FromFileInput("video.mp4")
                .WithArgument("-filter:a", "astats=metadata=1:reset=1")
                .WithArgument("-f", "null")
                .OutputToPipe(new StreamPipeSink(Console.OpenStandardOutput()))
                .ProcessSynchronously();
            string output4 = FFMpegArguments
                .FromFileInput("video.mp4")
                .UsingArguments("-filter:a astats=metadata=1:reset=1 -f null -")
                .OutputToPipe(new StreamPipeSink(Console.OpenStandardOutput()))
                .ProcessSynchronously();

In Windows and MAUI Android context. The 3rd line of each is in error WithArguments, AddParameter, WithArgument and UsingArguments

djaus2 avatar May 24 '25 11:05 djaus2