Search code examples
ffmpegdevelopment-environment

Pass option or argument in ffmpeg


I'm doing some modification into af_silencedetect.c file, one of the ffmpeg many filters and I want to pass a unique option in when I run ffmpeg. I need ffmpeg to save silence that it found and put them in different log file with unique ID that I'm passing, because I'm running multiple ffmpegs at the same time. Here is what I try to do:

ffmpeg -i audio.mp3 -vn -af silencedetect=n=-50dB:d=1:id=01 -f mp3 out.mp3

How to do that? How to create new parameter and pass it in and grep it inside ffmpeg?


Solution

  • I have been working a bit on ffmpeg and I know that it is a bit painful to start development of new features. They are very few infos for developers and the answers on the ffmpeg mailing list are not always helpful.

    Note: The following instructions suppose you are able to compile ffmpeg. Run the "ffmpeg_g" program with gdb, it is the debug version of ffmpeg.

    So for adding options you have to look to this line. For each option you want add a line in this array and set the parameters in this order :

    {option name, description, offset in the context object, type, default value, min value, max value, flags}

    Note: see other files for possible options types.

    Then for each option add a member in the context structure.

    And finally use your options with the context object that you obtain with this instruction.

    That's all, I hope it will help you.