Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a new filter to ffmpeg library

I am trying to add functionality to FFmpeg library. The issue is that in developer guide there are just general instruction on how to do it. I know that when I want to add something to ffmpeg I need to register the new functionality and rebuild the library so I can then call it somehow like so:

ffmpeg -i input.avi -vf "myfilter" out.avi

I do not want to officialy contribute. I would like to try to create the extra functionality and test it. The question is - is there any scelet file where the basic structure would be ready and you would just get a pointer to a new frame and processed it? Some directions or anything, because the source files are kinda hard to read without understanding its functions it calls inside.

like image 542
Croolman Avatar asked Dec 19 '25 01:12

Croolman


1 Answers

The document in the repo is worth a read: ffmpeg\doc\writing_filters.txt

The steps are:

  1. Add an appropriate line to the: ffmpeg\libavfilter\Makefile

    OBJS-$(CONFIG_MCSCALE_CUDA_FILTER) += vf_mcscale_cuda.o vf_mcscale_cuda.ptx.o scale_eval.o

  2. Add an appropriate line to the: ffmpeg\libacfilter\allfilters.c

    extern AVFilter ff_vf_mcscale_cuda;

  3. The change in (2) does not become recognized until ./configure scans the files again to configure the build, so run Configure and when you next run make the filter should be generated. Happy days.

like image 142
andrew pate Avatar answered Dec 20 '25 17:12

andrew pate