2

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.

Croolman
  • 1,103
  • 13
  • 40
  • 2
    Did you see `doc/writing_filters.txt`? – llogan Mar 02 '17 at 19:21
  • Shoot... I do not know why, but I tend to underestimate the documentation provided to any kind of sw. Thank you. That is, I guess, all I need. – Croolman Mar 02 '17 at 19:49
  • @llogan The green tick should be really yours. If you post the answer, I ll accept it. – Croolman Jul 12 '20 at 20:09
  • Thanks. I did answer in 2017, but it was deleted by a moderator and converted into a comment (which I deleted because it looked weird to have two comments from me mentioning `doc/writing_filters.txt`). I'll try voting to undelete [the answer](https://stackoverflow.com/a/42566125/), but I doubt it will be undeleted. Update: Posts deleted by moderators can't be undeleted by voting. – llogan Jul 12 '20 at 22:09

2 Answers2

2

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.

andrew pate
  • 3,833
  • 36
  • 28
1

i was faced with a problem to add transform_v1 filter (see details on transform 360 filters at https://www.diycode.cc/projects/facebook/transform360 ) to ffmpeg with the version N-91732-g1124df0. i did exactly according to writing_filters.txt but transform_v1.o is not linked?

i added the object file (vf_transform_v1.o) in Makefile of libavfilter. OBJS-$(CONFIG_TRANSFORM_V1_FILTER)+= vf_transform_v1.o

i checked that the define CONFIG_TRANSFORM_V1_FILTER=1 is present in config.h . However, after the compilation transform_v1 is still not recognized. i resolved this issue in an awkward way, i added explicitly vf_transform_v1.o in OBJ-list without conditioning by the global define CONFIG_TRANSFORM_V1_FILTER:

OBJS+= vf_transform_v1.o