GithubHelp home page GithubHelp logo

dyne / frei0r Goto Github PK

View Code? Open in Web Editor NEW
408.0 24.0 90.0 5.43 MB

A large collection of free and portable video plugins

Home Page: https://frei0r.dyne.org/

License: GNU General Public License v2.0

CMake 3.75% Makefile 0.04% C 73.04% C++ 23.18%
video-effects video-filtering plugins windows osx linux dyne

frei0r's Introduction

Frei0r logo

frei0r frei0r

What frei0r is

The frei0r project is a collection of free and open source video effects plugins that can be used with a variety of video editing and processing software.

For an extensive introduction to frei0r please read this story.

The frei0r project welcomes contributions by people who are passionate about video effects, its collection consists of more than 100 plugins made to work on any target platform (GNU/Linux, Apple/OSX and MS/Win) without the need for special video hardware. These plugins can be used to add a wide range of effects to video, such as color correction, blurring, and distortion.

The frei0r project is a great resource for anyone interested in algorithms for video transformation and effects, as it provides a wide range of open source formulas available for free and can be easily integrated into a variety of software.

What frei0r is not

Frei0r itself is just a C/C++ header and a collection of small programs using it to accept an input frame, change it in any possible way and return an output frame.

It is not meant as a generic API for all kinds of video applications, as it doesn't provides things like an extensive parameter mechanism or event handling.

Eventually the frei0r API can be wrapped by higher level APIs expanding its functionalities, for instance GStreamer, MLT, FFmpeg and Pure Data do.

Links

Wikipedia page about frei0r: https://en.wikipedia.org/wiki/Frei0r

Some applications using frei0r, sorted in order of most recent activity

Downloads

Stable frei0r releases are built automatically and made available on

Frei0r sourcecode is released under the terms of the GNU General Public License and, eventually other compatible Free Software licenses.

Build dependencies

Frei0r can be built on GNU/Linux, M$/Windows and Apple/OSX platforms, possibly in even more environments like embedded devices.

For details see the BUILD file.

MS / Windows

We distribute official builds of frei0r plugins as .dll for the Win64 platform from the releases page.

BSD

Ports of frei0r are included in all major BSD distros:

GNU / Linux

Binary packages are maintained on various distributions, but they may not be completely up to date with the latest release.

Apple / OSX

A frei0r Brew formula is available.

Official builds of frei0r plugins as .dlsym for the Apple/OSX platform will be soon included in the releases page.

Documentation

If you are new to frei0r (but not to programming) the best thing is probably to have a look at the frei0r header, which is quite simple and well documented. The doxyfied documentation is also available for browsing online.

C++ Filter example

You could find a tutorial filter here in the source code. A simple skeleton for a frei0r video filter looks like this:

  #include <frei0r.hpp>
  
  typedef struct {
    int16_t w, h;
    uint8_t bpp;
    uint32_t size;
  } ScreenGeometry;
  
  class MyExample: public frei0r::filter {
  public:
    MyExample(int wdt, int hgt);
    ~MyExample();
    virtual void update();
  private:
    ScreenGeometry geo;
    void _init(int wdt, int hgt);
  }
  
  MyExample::MyExample() { /* constructor */ }
  MyExample::~MyExample() { /* destructor */ }
  
  void MyExample::_init(int wdt, int hgt) {
    geo.w = wdt;
    geo.h = hgt;
    geo.bpp = 32; // this filter works only in RGBA 32bit
    geo.size = geo.w*geo.h*(geo.bpp/8); // calculate the size in bytes
  }
  
  void MyExample::update() {
    // we get video input via buffer pointer (void*)in 
    uint32_t *src = (uint32_t*)in;
    // and we give video output via buffer pointer (void*)out
    uint32_t *dst = (uint32_t*)out;
    // this example here does just a copy of input to output
    memcpy(dst, src, geo.size);
  }
    
  frei0r::construct<MyExample>
          plugin("MyExample", "short and simple description for my example",
                 "Who did it", 1, 0);

Join us

To contribute your plugin please open a pull request.

For bug reporting please use our issue tracker.

You can get in touch with some developers over various dyne.org chat channels, for instance

We also have an (old) mailing list open to subscription and we provide public archives of discussions, searchable and indexed online.

Acknowledgments

Frei0r is the result of a collective effort in coordination with several software developers meeting to find a common standard for video effect plugins to be used among their applications.

For a full list of contributors and the project history, see the file AUTHORS, the ChangeLog and the project web page: https://frei0r.dyne.org

frei0r's People

Contributors

andre-caldas avatar bmatherly avatar cwilling avatar d-j-a-y avatar ddennedy avatar esmane avatar gbendy avatar granjow avatar hypov8 avatar hzeller avatar j-b-m avatar jaromil avatar jddurand avatar jliljebl avatar kwizart avatar m4ks1k avatar mingwandroid avatar namikiri avatar oracle2025 avatar othko97 avatar rosslagerwall avatar rrrapha avatar schnoellm avatar sgorpi avatar shammash avatar smimram avatar ttill avatar umlaeute avatar undoundoundo avatar xsbee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

frei0r's Issues

Not an issue as such.. How do you get all the patterns 0-7 working with the frei0r plugins [frei0r-src-test-pat-b type=5]

I'm wanting to use to test-pat-b.so (plugin) as video source [frei0r-src-test-pat-b] type=5 to be exact for a project. frei0r is packed in with gstreamer-bad-plugins.
Currently I have the plugin working with gstreamer using pipeline:-
'gst-launch-1.0 frei0r-src-test-pat-b type=5 ! videoconvert ! autovideosink' which shows colour bars ignoring or complaining about gdouble not allowing type=5 from the pipeline.
To me, seems the build is limited to use Type 0 or 1 sources ignoring list available in the frei0r documentation for real estate savings.

Is my assumption correct?

Can't see any reference to any of the test-pat-b code Type 0 and 1 in the gstfrei0rsrc.c however, seems to me the code to load the plugin through idx? gstreamer plugin loads frei0r plugin?

I have downloaded the full source for frei0r from git and built without any problems. I then rebuilt my bad plugin using meson --reconfigure builddir thinking meson needed to include all dependencies from the frei0r library. Didn't help.

I've search the interwebs and drawn a blank. Not much in on how-to use the frei0r sources although some mentions of created gst as my vendor..
Setup a FREI0R_PATH=:/usr/local/lib/frei0r-1/gst however after many hours remains allusive to get the full list of test patterns working?
I really like to use the PM5544 look-a-like. What am I doing wrong or missing or is this an issue?

Sebastian Drรถge. any assistance would be appreciated gstreamer plugin for frei0r as your name comes up in the plugin.

I'm using Ubuntu 22.04 LTS with gstreamer 1.20.3 built for source.

The automated release is failing ๐Ÿšจ

๐Ÿšจ The automated release from the master branch failed. ๐Ÿšจ

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. Iโ€™m sure you can fix this ๐Ÿ’ช.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those donโ€™t help, or if this issue is reporting something you think isnโ€™t right, you can always ask the humans behind semantic-release.


Missing name property in package.json.

The package.json's name property is required in order to publish a package to the npm registry.

Please make sure to add a valid name for your package in your package.json.


Good luck with your project โœจ

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

Fails to build with opencv 3.4.2

I'm getting this compile error when using the newly released opencv 3.4.2:

filter/facebl0r/facebl0r.cpp: In member function โ€˜virtual void FaceBl0r::update(double, uint32_t*, const uint32_t*)โ€™:
filter/facebl0r/facebl0r.cpp:224:45: error: โ€˜CV_RGBโ€™ was not declared in this scope
               cvEllipseBox(image, face_box, CV_RGB(255,0,0), 2, CV_AA, 0);
                                             ^~~~~~
filter/facebl0r/facebl0r.cpp:224:45: note: suggested alternative: โ€˜CV_Cโ€™
               cvEllipseBox(image, face_box, CV_RGB(255,0,0), 2, CV_AA, 0);
                                             ^~~~~~
                                             CV_C

It builds fine when using opencv 3.4.1.

It seems that the macro CV_RGB is not defined anymore in opencv 3.4.2.

System Information:
OS: Arch Linux x86_64
Compiler: gcc 8.1.1
frei0r-plugins: git master
opencv: 3.4.2

Installation location of pkgconfig files is hardcoded

Currently the installation location of pkgconfig files is hardcoded to ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig, which causes issues if the system pkg-config is configured to use a different location.

For example in freedesktop-sdk we use debian's multiarch system, with our pkg-config path configured to be in /usr/lib/${multiarch-triplet}/pkgconfig. As a result we wouldn't be able to use pkg-config to detect frei0r. See the work to add frei0r support in freedesktop-sdk here for an example of the issue.

fabsf warning

clang generates warnings like this:

/home/rapha/frei0r/src/filter/c0rners/c0rners.c:240:8: warning: absolute value function 'fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value [-Wabsolute-value]
                        if (fabsf(aa)>fabsf(bb))

windows 10 does not load dll

IN FFMPEG when looking for frei0r effect in correct environment path results in "could not find module" and fails.

I is definitely finding the correct pathway and simply "not seeing" the .dll files ?

This works fine in windows 7

consolidate build-systems

as of #95 , i think it's clear that having to maintain two (complex) build-systems is a chore and error prone.
iirc, there's hasn't been a release in almost 5 years that had a non-broken autotools setup.

i therefore suggest to just remove the build system you do not like.

'cartoon' acceptable parameter values

I'm playing with 'cartoon' in Pure Data / GEM.

I can't see any effect with the 'triplevel' input -- all values give the same result.

If diffspace * 256 < 1.0, I get a valid image but not a very strong effect. If diffpace * 256 > 1.0, it goes black and white and the result is not useful at all.

I must be misunderstanding something but I don't know what.

All other frei0r plugins I've tried in Pd do as advertised -- 'cartoon' is the odd one out. So I can't rule out that maybe cartoon is just buggy.

How to convert an input RGBA frame into an RGB one?

Hello @ddennedy ,

apologies for opening an issue, it just seemed quicker and with better support for posting code snippets ๐Ÿ˜‰ . I am trying to do something conceptually simple: I need to take the input frame that is addressed by the uint32_t *in pointer in the update callback and drop the alpha out of it.

Bigger context: I need to call a (Python) library (via the C interpreter) that accepts only images without the alpha channel or, to be more precise, a numpy array as a matrix of triples (R,G,B). My cunning plan was to mostly copy what the cartoon filter was doing and take from there. In particular, I thought about the following:

  • Allocate a memory chunk of size sizeof(char) * (frame_width * frame_height * 3), where each r,g,b value would be stored as a separate char, as opposed as a single int32 integer like the input frame;
  • Iterate over the pixels of the input frame, do some xoring and shifting to get the value of r,g,b out of the input pixel, store it in my memory chunk contiguously;
  • Do any processing I need to do;
  • Invert the process and go from the 3 individual color channels in my memory chunk into individual pixels in the out frame.

This seems to "kinda work", but I get a grayscale image, and by dumping the numpy matrix on stdout is clear I am doing something silly. Super stripped down version of the code:

#define RED(n)  ((n>>16) & 0x000000FF)
#define GREEN(n) ((n>>8) & 0x000000FF)
#define BLUE(n)  (n & 0x000000FF)
#define RGB(r,g,b) ((r<<16) + (g <<8) + (b))

...

// "in" is the pointer to the input frame I am given from frei0r;
// "geo" is a simple data structure copied from the cartoon filter, host the screen size
// yprecal is taken from cartoon and is populate in the constructor to be essentially double the height.

memset((void*)frameBuffer, 0xFF, sizeof(char) * (geo->w * geo->h * 3));

int32_t pixel;

for (x=(int)0;x<geo->w;x++) {
    for (y=(int)0;y<geo->h;y++) {

              char r,g,b;

              pixel = *(in+x+yprecal[y]);
              r     = RED(pixel);
              g     = GREEN(pixel);
              b     = BLUE(pixel);

              *(frameBuffer+x+yprecal[y])     = 0xED;
              *(frameBuffer+x+yprecal[y] + 1) = 0xBD;
              *(frameBuffer+x+yprecal[y] + 2) = 0x13;

    }
}
...

// inverting the process, later on

for (x=(int)0;x<geo->w;x++) {
    for (y=(int)0;y<geo->h;y++) {

                  char r,g,b;
                  int32_t rgba;

                  r = *(frameBuffer+x+yprecal[y]);
                  g = *(frameBuffer+x+yprecal[y] + 1);
                  b = *(frameBuffer+x+yprecal[y] + 2);

                  rgba = RGB(r,g,b);

                  *(out+x+yprecal[y]) = rgba;


    }
}

I am opening this ticket as I would like to understand where is the hole in my reasoning and why this mysterious yprecal array even work. As said it was shamelessly stolen by cartoon and is initialised like this in the constructor:

      if ( geo->size > 0 ) {
          frameBuffer = (char*)malloc(sizeof(char) * (geo->w * geo->h * 3));

          yprecal = (int*)malloc(geo->h*2*sizeof(int));
      }
      for(c=0;c<geo->h*2;c++)
          yprecal[c] = geo->w*c;

It seems some way of mapping between "screen space" and some other kind of coordinate system, but I am afraid this is beyond my level of ffmpeg/frei0r expertise.

Thanks in advance ๐Ÿ˜‰

emboss segfault

I get a segfault when using the emboss filter (on OpenBSD):

#0  f0r_update (instance=0x18251960fc00, time=0, inframe=0x1824c1d69000, outframe=0x18247bff2000) at /tmp/frei0r/src/filter/emboss/emboss.c:178
178         bumpPixels[index++] = (r + g + b)/3;
(gdb) bt
#0  f0r_update (instance=0x18251960fc00, time=0, inframe=0x1824c1d69000, outframe=0x18247bff2000) at /tmp/frei0r/src/filter/emboss/emboss.c:178
#1  0x00001824e2e1482c in filter_frame () from /usr/local/lib/libavfilter.so.7.3
#2  0x00001824e2dc9cdb in ff_filter_frame_framed () from /usr/local/lib/libavfilter.so.7.3
#3  0x00001824e2dcb6b8 in ff_filter_frame () from /usr/local/lib/libavfilter.so.7.3
#4  0x00001824e2e548e7 in filter_frame () from /usr/local/lib/libavfilter.so.7.3
#5  0x00001824e2dc9cdb in ff_filter_frame_framed () from /usr/local/lib/libavfilter.so.7.3
#6  0x00001824e2dcb6b8 in ff_filter_frame () from /usr/local/lib/libavfilter.so.7.3
#7  0x00001824e2dd0ccb in request_frame () from /usr/local/lib/libavfilter.so.7.3
#8  0x00001824e2dd0289 in av_buffersrc_add_frame_internal () from /usr/local/lib/libavfilter.so.7.3
#9  0x00001824e2dcff54 in av_buffersrc_add_frame_flags () from /usr/local/lib/libavfilter.so.7.3
#10 0x000018226f81c626 in log_callback_help () from /usr/local/bin/ffmpeg
#11 0x000018226f8194f6 in log_callback_help () from /usr/local/bin/ffmpeg
#12 0x000018226f81418e in log_callback_help () from /usr/local/bin/ffmpeg
#13 0x000018226f801906 in ?? () from /usr/local/bin/ffmpeg

New release

There are some commits in Master that Kdenlive needs for alpha rendering. Would it possible to have a new release?

delay0r memory leak

My system quickly runs out of memory when jumping around on the timeline in kdenlive or just hide/unhide the filter a couple of times.

lenscorrection needs interpolation

Currently it seems the lenscorrection filter does not use any interpolation (or well, effectively nearest neighbor???). This leads to clearly visible stairstepping artifacts which is especially noticable on scenes with clear geometric shapes at the edge of the frame.

It would be nice to have a interpolation=bilinear or interpolation=lanczos2 option available

It would also be nice for the lenscorrection filter to be able to apply an automatic "zoom", so the input resolution = output resolution without any green border visible.

timeout filter issues

The filter can cause a segfault when invoked without any parameters:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00001069779a53d4 in ABGR::blend (this=0x7f7ffffc9168, other=..., opacity=3001)
    at /tmp/frei0r/src/filter/timeout/timeout.cpp:42
42              ret.r = l*r + r*other.r;

Otherwise the filter works, but the red component of the color parameter is ignored and
the height of the displayed rectangle seems to be one pixel off.

Missing sin cos symbol for emboss

Hi,

I'm building the latest from master. When using with melt and kdenlive, when we use emboss, gdb report sin and cos symbols are missing. But I do see -lm in the makefile for emboss. Any idea on what can be wrong?

Thanks

sprintf src and dest the same not allowed

filter/measure/pr0file.c:327:5: warning: passing argument 1 to restrict-qualified parameter aliases with argument 3 [-Wrestrict]

Source code is

sprintf(str,"%s %s",str,"Mk1= -----");

man sprintf says:

   Some programs imprudently rely on code such as the following

       sprintf(buf, "%s some further text", buf);

   to append text to buf.  However, the standards explicitly note that the
   results are undefined if source and destination  buffers  overlap  when
   calling  sprintf(), snprintf(), vsprintf(), and vsnprintf().  Depending
   on the version of gcc(1) used, and the compiler options employed, calls
   such as the above will not produce the expected results.

Many more examples in the same file. Suggest compile with -Wrestrict.

new release soon ?

latest release was 1 year and a half, is a new release planned soon ?

glow plugin to support different blurs

Hi team,

Ive been trying to use ffmpeg's filters to essentially add glow to a series of artistic videos by manually blurring and then blending. Obviously it doesn't work too well.

Then I saw a link to the frei0r plugins and thought "perfect", so I set it up, and ran with default filters frei0r=glow:1 in ffmpeg, and the output did have glow, but with a very streaky blur and with artifacts, when I was hoping for something like a Gaussian blur. Image of the input and output attached.

Perhaps I'm simply using the filter wrong and someone can correct me, but if not, this may be an interesting customisation to add if anyone has the inclination. I read through the code in the hopes of being able to submit a PR, but feel out of my depth!

Input:

input

Run command:

ffmpeg -i input.png -vf frei0r=glow:1 output.png

Ouptput:

output

autogen.sh error

I'm getting an error when running autogen.sh to compile frei0r plugins. The output is big and I have attached.

The configure file is not generated.
Running autoreconf -si also produces error.

System information:
OS: Arch Linux x86_64
frei0r-plugins: git master (currently at 1.6.0.r0.g07ba37c)
autoconf: 2.69
autoconf-archive: 2017.03.21
automake: 1.14
Compiler: gcc 6.3.1
glibc: 2.25
OpenCV: 3.2.0
Gavl: 1.4.0
Cairo: 1.14.8

Steps to reproduce:

$ git clone https://github.com/dyne/frei0r.git frei0r-plugins-git
$ cd frei0r-plugins-git
$ ./autogen.sh

frei0r-plugins-autogen-error.txt

frei0r plugin for kdenlive

This may not be the right place to ask for help, but I can't get any response on the frei0r mailinglist...

I wrote a C++ frei0r plugin that uses 4 parameters (LEFT,TOP,RIGHT,BOTTOM) to delimit a cropping rectangle for further processing. I can modify and draw the outline of the rectangle over the input frame as I modify the sliders (defined in a proper .xml file).

I would like to add (for example...) a SIZE parameter that, when modified, would adjust the other parameters to reflect the change proportionnaly. This means that I have to be able to change values of parameters from inside the plugin and have the application (kdenlive) react to the changes and update the effect GUI accordingly.

Is this at all possible? None of the other frei0r plugins (C or C++) seem to need/use/enable this feature.

Anybody know how to do this? (the get_param_value/set_param_value functions seem to be of no use for this purpose).

Naming and Demo Video of Frei0r

Not an issue, but I didn't find any other way to ask questions that make me curious about this library. Frei0r's website, name and demo video even motivated me to commit two filters (see #7 and #9). Frei0r is a very impressive project! So I have some questions about it and I hope to get the answers.

The Name

What does Frei0r mean? Googling around didn't give me the answer, only small Wiktionary page that says that 'freior' means 'scare' in Occitan language. Who invented the name, what's behind it? Very interesting for me!

The 'Logo'

Additional attention is paid by me to the Frei0r's logo that posted on frei0r.dyne.org. What font is used to make it? And the line striked through zero, it's inverted! Any meaning or just a quick stub?

Demo Video

This video made me to love Frei0r forever. Its' strangeness, weirdness, the sample that is used to test Frei0r's filters โ€” combination of these factors made this video best of demonstration clips ever. When I've watching it, music came to my head automatically. I've tried to add it and it fits perfectly!
So, is there any version (maybe HD, or remastered, or in higher resolution)? How did you make it? Programmatically or using software that uses Frei0r?

And again

I want to thank everybody who contributed and supports Frei0r, the most impressive project for me.

Crash with pixelize effect

A crash is happening when using the pixeliz0r effect reported here.

Full log

Thread 76 (Thread 0x7ffe9a7fc640 (LWP 19667) "RenderThread"):
#0  0x00007fffa9a6b3e3 in f0r_update () at /usr/lib64/frei0r-1/pixeliz0r.so
#1  0x00007fffc77a8282 in f0r_update_slice (id=<optimized out>, index=<optimized out>, count=<optimized out>, context=<optimized out>) at frei0r_helper.c:63
        ctx = <optimized out>
        slice_height = <optimized out>
        slice_offset = <optimized out>
        input = <optimized out>
        output = <optimized out>
#2  0x00007ffff6afc9a8 in mlt_slices_worker (p=0x7fff84306fb0) at mlt_slices.c:117
        id = 5
        idx = 0
        r = 0x7fff51d70f40
        ctx = 0x7fff84306fb0
        __FUNCTION__ = "mlt_slices_worker"
#3  0x00007ffff4400299 in start_thread () at /usr/lib/libpthread.so.0
#4  0x00007ffff4bcb053 in clone () at /usr/lib/libc.so.6

rgbsplit0r segfault

The issue is problably related to this commit: 3f685db

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000014cd709d1be3 in rgbsplit0r_extract_color (pixelIn=0x14ccafcb6000, pixelOut=0x14cccec06a38, colorIndex=2) at /tmp/frei0r/src/filter/rgbsplit0r/rgbsplit0r.c:59
59                  pxOut[2] = pxIn[2];

(gdb) bt
#0  0x000014cd709d1be3 in rgbsplit0r_extract_color (pixelIn=0x14ccafcb6000, pixelOut=0x14cccec06a38, colorIndex=2)
    at /tmp/frei0r/src/filter/rgbsplit0r/rgbsplit0r.c:59
#1  0x000014cd709d19eb in f0r_update (instance=0x14cccec06a20, time=0, inframe=0x14ccaf235000, outframe=0x14cd3bf63000)
    at /tmp/frei0r/src/filter/rgbsplit0r/rgbsplit0r.c:203
#2  0x000014cd3ba1882c in filter_frame () from /usr/local/lib/libavfilter.so.7.3
#3  0x000014cd3b9cdcdb in ff_filter_frame_framed () from /usr/local/lib/libavfilter.so.7.3

...

filter/edgeglow/edgeglow.cpp:160:9: warning: duplicated 'if' condition [-Wduplicated-cond]

Source code is

     if (tr<1./6.) g[0]=CLAMP0255(p+((q-p)*6.*tr));
      else if (tr<0.5) g[0]=CLAMP0255((int32_t)q);
      else if (tr<1./6.) g[0]=CLAMP0255(p+((q-p)*6.*(2./3.-tr)));

also:

filter/edgeglow/edgeglow.cpp:165:9: warning: duplicated 'if' condition [-Wduplicated-cond]
filter/edgeglow/edgeglow.cpp:170:9: warning: duplicated 'if' condition [-Wduplicated-cond]

Duplicates

Compilation problem with OpenCV

On OpenBSD, the following error occurs when compiling facedetect/facebl0r:

$ cmake .
$ make VERBOSE=1
[  1%] Building CXX object src/filter/facebl0r/CMakeFiles/facebl0r.dir/facebl0r.cpp.o
cd /tmp/frei0r/src/filter/facebl0r && /usr/bin/c++  -Dfacebl0r_EXPORTS -I/tmp/frei0r/include -I/usr/local/include/opencv  -g -DNDEBUG -fPIC   -o CMakeFiles
/facebl0r.dir/facebl0r.cpp.o -c /tmp/frei0r/src/filter/facebl0r/facebl0r.cpp
/tmp/frei0r/src/filter/facebl0r/facebl0r.cpp:21:10: fatal error: 'opencv2/opencv.hpp' file not found
#include <opencv2/opencv.hpp>
         ^~~~~~~~~~~~~~~~~~~~

Workaround:
$ cmake . -DCMAKE_CXX_FLAGS=-I/usr/local/include

Plugin fuzzing test

Include a test for fuzzing the input of plugins and loading them one-by-one with a test video source and changing every parameter with all possible values (perhaps also beyond the defined scope) to test their stability.

Links

Frei0r successfully cross-compiled in OpenEmbedded

This is just an information post, in case anyone is interested. Leave it open for a short time then close it.

I have successfully cross-compiled frei0r, see my blog post:

https://bkhome.org/news/202201/frei0r-compiled-in-openembedded.html

...frei0r developers might be interested to see the problems that I had to workaround.

Yocto/OpenEmbedded is a cross-compile environment. Normally you would run on a x86_64 Linux PC and can build for any target cpu. I build for x86_64 and aarch64, and so far have recipes for about 870 packages, see a howto here:

https://bkhome.org/news/202112/how-to-cross-compile-850-packages-using-yoctoopenembedded.html

Web page outdated malware risky

I found this project on https://www.dyne.org/software/frei0r
and the links there are broken or misspelled.
For example, instead of "github" it say "githhub" that carry you to another web site (that is not the real github).
The links about "latest announcement" and "overview of code activity" are broken. That made me think that the project is dead.
And there may be more things to fix.

So I guess the site needs to be reviewed.

facebl0r not working

After getting OpenCV installed from source and following your installation instructions of

  1. Clone repo
  2. ./autogen.sh
  3. ./configure
Compile frei0r-plugins 1.6.1 for x86_64-unknown-linux-gnu

    - INSTALL prefix: /usr/local
    - CPU optimization: YES
    - opencv: YES
              data dir:
    - gavl: NO
            gavl >= 0.2.3 not found - this program enables optional
            plugin with the gmerlin audio video library >= 0.2.3
            http://gmerlin.sourceforge.net/
    - cairo: NO
            cairo >= 1.0.0 not found - this program enables optional
            plugin with the Cairo 2D vector graphics library >= 1.0.0
            http://www.cairographics.org/

Now you can run make.
  1. make -j
  2. sudo make install

Doing this seems to put a facebl0r.so in both /usr/local/lib/frei0r-1/facebl0r.so & /home/USER/frei0r/src/.libs/facebl0r.so

Moving either of these to a directory where FFmpeg can pick it up and run running ffmpeg -v debug -i ~/samplevideo.mp4 -vf "frei0r=facebl0r" ~/facebl0rtest.mp4 seems to run through the process but the final file is the same as the original with no effects applied?

plugins registering wrong datatype for boolean params

For example, tutorial.cpp has this code:

public:
    Tutorial(unsigned int width, unsigned int height)
    {
        register_param(m_barSize, "barSize", "Size of the black bar");
        register_param(m_pointerMethod, "pointerMethod", "Pointer Method (internal)");
...

private:
    f0r_param_double m_barSize;
    f0r_param_bool m_pointerMethod;
...

Because f0r_param_bool is of type 'double', the wrong register_param function is called for m_pointerMethod.

I see two ways of fixing this without breaking external API/ABI compatibility.

  1. change the param datatypes in tutorial.cpp:
    f0r_param_double m_barSize;
    bool m_pointerMethod;
  1. change the register_param function (in frei0r.hpp) to something like this:
    void register_param(f0r_param_t p_loc,
                        int type,
                        const std::string& name,
                        const std::string& desc)
    {
      param_ptrs.push_back(p_loc);
      s_params.push_back(param_info(name,desc,type));
    }

and change the calls in tutorial.cpp:

    register_param(&m_barSize, F0R_PARAM_DOUBLE, "barSize", "Size of the black bar");
    register_param(&m_pointerMethod, F0R_PARAM_BOOL, "pointerMethod", "Pointer Method (internal)");

I prefer the second version because most plugins already use f0r_param_bool for the boolean params and the calls to register_param could be changed mechanically.

issues creating/installing static libs

./configure --prefix=${TARGET}2 --without-cairo --without-opencv --without-gavl --enable-static --disable-shared

The compile phase works, but at make install, I get the following errors:

mkdir -p //Users/Shared/ffmpeg/sw2/lib/frei0r-1
list='3dflippo.la addition.la addition_alpha.la alpha0ps.la alphaatop.la alphagrad.la alphain.la alphainjection.la alphaout.la alphaover.la alphaspot.la alphaxor.la B.la balanc0r.la baltan.la blend.la bluescreen0r.la bgsubtract0r.la brightness.la burn.la bw0r.la c0rners.la cartoon.la cluster.la colgate.la coloradj_RGB.la colordistance.la colorhalftone.la colorize.la colortap.la color_only.la composition.la contrast0r.la curves.la d90stairsteppingfix.la darken.la defish0r.la delay0r.la delaygrab.la difference.la distort0r.la dither.la divide.la dodge.la edgeglow.la emboss.la equaliz0r.la flippo.la G.la gamma.la glow.la glitch0r.la grain_extract.la grain_merge.la hardlight.la hqdn3d.la hue.la hueshift0r.la IIRblur.la invert0r.la ising0r.la keyspillm0pup.la lenscorrection.la letterb0xed.la levels.la lighten.la lightgraffiti.la lissajous0r.la luminance.la mask0mate.la medians.la multiply.la ndvi.la nervous.la nois0r.la nosync0r.la onecol0r.la overlay.la partik0l.la perspective.la pixeliz0r.la plasma.la posterize.la pr0be.la pr0file.la primaries.la R.la RGB.la rgbnoise.la rgbsplit0r.la saturation.la saturat0r.la scanline0r.la screen.la select0r.la sharpness.la sigmoidaltransfer.la sobel.la softglow.la softlight.la sopsat.la spillsupress.la squareblur.la subtract.la tehroxx0r.la test_pat_B.la test_pat_C.la test_pat_G.la test_pat_I.la test_pat_L.la test_pat_R.la three_point_balance.la threshold0r.la threelay0r.la timeout.la tint0r.la transparency.la twolay0r.la uvmap.la value.la vertigo.la vignette.la xfade0r.la   '; \
	for file in $list; do \
	  sofile=`basename $file .la`.so; \
	  /usr/bin/install -c .libs/$sofile //Users/Shared/ffmpeg/sw2/lib/frei0r-1; \
	done
install: .libs/3dflippo.so: No such file or directory
install: .libs/addition.so: No such file or directory
install: .libs/addition_alpha.so: No such file or directory
install: .libs/alpha0ps.so: No such file or directory
install: .libs/alphaatop.so: No such file or directory
install: .libs/alphagrad.so: No such file or directory
install: .libs/alphain.so: No such file or directory
install: .libs/alphainjection.so: No such file or directory
install: .libs/alphaout.so: No such file or directory
install: .libs/alphaover.so: No such file or directory
install: .libs/alphaspot.so: No such file or directory
install: .libs/alphaxor.so: No such file or directory
install: .libs/B.so: No such file or directory
install: .libs/balanc0r.so: No such file or directory
install: .libs/baltan.so: No such file or directory
install: .libs/blend.so: No such file or directory
install: .libs/bluescreen0r.so: No such file or directory
install: .libs/bgsubtract0r.so: No such file or directory
install: .libs/brightness.so: No such file or directory
install: .libs/burn.so: No such file or directory
install: .libs/bw0r.so: No such file or directory
install: .libs/c0rners.so: No such file or directory
install: .libs/cartoon.so: No such file or directory
install: .libs/cluster.so: No such file or directory
install: .libs/colgate.so: No such file or directory
install: .libs/coloradj_RGB.so: No such file or directory
install: .libs/colordistance.so: No such file or directory
install: .libs/colorhalftone.so: No such file or directory
install: .libs/colorize.so: No such file or directory
install: .libs/colortap.so: No such file or directory
install: .libs/color_only.so: No such file or directory
install: .libs/composition.so: No such file or directory
install: .libs/contrast0r.so: No such file or directory
install: .libs/curves.so: No such file or directory
install: .libs/d90stairsteppingfix.so: No such file or directory
install: .libs/darken.so: No such file or directory
install: .libs/defish0r.so: No such file or directory
install: .libs/delay0r.so: No such file or directory
install: .libs/delaygrab.so: No such file or directory
install: .libs/difference.so: No such file or directory
install: .libs/distort0r.so: No such file or directory
install: .libs/dither.so: No such file or directory
install: .libs/divide.so: No such file or directory
install: .libs/dodge.so: No such file or directory
install: .libs/edgeglow.so: No such file or directory
install: .libs/emboss.so: No such file or directory
install: .libs/equaliz0r.so: No such file or directory
install: .libs/flippo.so: No such file or directory
install: .libs/G.so: No such file or directory
install: .libs/gamma.so: No such file or directory
install: .libs/glow.so: No such file or directory
install: .libs/glitch0r.so: No such file or directory
install: .libs/grain_extract.so: No such file or directory
install: .libs/grain_merge.so: No such file or directory
install: .libs/hardlight.so: No such file or directory
install: .libs/hqdn3d.so: No such file or directory
install: .libs/hue.so: No such file or directory
install: .libs/hueshift0r.so: No such file or directory
install: .libs/IIRblur.so: No such file or directory
install: .libs/invert0r.so: No such file or directory
install: .libs/ising0r.so: No such file or directory
install: .libs/keyspillm0pup.so: No such file or directory
install: .libs/lenscorrection.so: No such file or directory
install: .libs/letterb0xed.so: No such file or directory
install: .libs/levels.so: No such file or directory
install: .libs/lighten.so: No such file or directory
install: .libs/lightgraffiti.so: No such file or directory
install: .libs/lissajous0r.so: No such file or directory
install: .libs/luminance.so: No such file or directory
install: .libs/mask0mate.so: No such file or directory
install: .libs/medians.so: No such file or directory
install: .libs/multiply.so: No such file or directory
install: .libs/ndvi.so: No such file or directory
install: .libs/nervous.so: No such file or directory
install: .libs/nois0r.so: No such file or directory
install: .libs/nosync0r.so: No such file or directory
install: .libs/onecol0r.so: No such file or directory
install: .libs/overlay.so: No such file or directory
install: .libs/partik0l.so: No such file or directory
install: .libs/perspective.so: No such file or directory
install: .libs/pixeliz0r.so: No such file or directory
install: .libs/plasma.so: No such file or directory
install: .libs/posterize.so: No such file or directory
install: .libs/pr0be.so: No such file or directory
install: .libs/pr0file.so: No such file or directory
install: .libs/primaries.so: No such file or directory
install: .libs/R.so: No such file or directory
install: .libs/RGB.so: No such file or directory
install: .libs/rgbnoise.so: No such file or directory
install: .libs/rgbsplit0r.so: No such file or directory
install: .libs/saturation.so: No such file or directory
install: .libs/saturat0r.so: No such file or directory
install: .libs/scanline0r.so: No such file or directory
install: .libs/screen.so: No such file or directory
install: .libs/select0r.so: No such file or directory
install: .libs/sharpness.so: No such file or directory
install: .libs/sigmoidaltransfer.so: No such file or directory
install: .libs/sobel.so: No such file or directory
install: .libs/softglow.so: No such file or directory
install: .libs/softlight.so: No such file or directory
install: .libs/sopsat.so: No such file or directory
install: .libs/spillsupress.so: No such file or directory
install: .libs/squareblur.so: No such file or directory
install: .libs/subtract.so: No such file or directory
install: .libs/tehroxx0r.so: No such file or directory
install: .libs/test_pat_B.so: No such file or directory
install: .libs/test_pat_C.so: No such file or directory
install: .libs/test_pat_G.so: No such file or directory
install: .libs/test_pat_I.so: No such file or directory
install: .libs/test_pat_L.so: No such file or directory
install: .libs/test_pat_R.so: No such file or directory
install: .libs/three_point_balance.so: No such file or directory
install: .libs/threshold0r.so: No such file or directory
install: .libs/threelay0r.so: No such file or directory
install: .libs/timeout.so: No such file or directory
install: .libs/tint0r.so: No such file or directory
install: .libs/transparency.so: No such file or directory
install: .libs/twolay0r.so: No such file or directory
install: .libs/uvmap.so: No such file or directory
install: .libs/value.so: No such file or directory
install: .libs/vertigo.so: No such file or directory
install: .libs/vignette.so: No such file or directory
install: .libs/xfade0r.so: No such file or directory
make[2]: *** [install-pluginLTLIBRARIES] Error 71
make[1]: *** [install-am] Error 2
make: *** [install-recursive] Error 1

I checked the src/.libs dir and the static libs (*.a) are available (so the compile process worked).

But the install process tries to install shared objects (the dyn libs) instead.

I also find it strange that there are 123 static libraries. I want one single static library.
I understand that these are plugins, but I want them all to be available in a static binary, thus one library would be an advantage.

build failure OS X

 $ cmake .
-- Checking for module 'opencv'
--   No package 'opencv' found
-- WARNING: OpenCV was not found. Please specify OpenCV directory using OpenCV_DIR env. variable
-- Checking for module 'cairo'
--   No package 'cairo' found
-- Checking for module 'gavl'
--   No package 'gavl' found
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/rdp/dev/ffmpeg-windows-build-helpers/sandbox/native/frei0r_git
frei0r_git rdp$ make
[  0%] Linking C shared module 3dflippo.so
ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
ld: in '/usr/local/lib/libunwind.dylib', file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libunwind.dylib for architecture i386
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/filter/3dflippo/3dflippo.so] Error 1
make[1]: *** [src/filter/3dflippo/CMakeFiles/3dflippo.dir/all] Error 2
make: *** [all] Error 2

frei0r can not be built on Oracle Linux 8

Environment info

NAME="Oracle Linux Server"
VERSION="8.7"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.7"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.7"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:7:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.7
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.7
        make: make-4.2.1-11.el8.x86_64
         gcc: gcc-8.5.0-15.0.2.el8.x86_64
     gcc-c++: gcc-c++-8.5.0-15.0.2.el8.x86_64
    automake: automake-1.16.5-0.el8.noarch
     libtool: libtool-2.4.6-25.el8.x86_64
    autoconf: autoconf-2.69-29.el8.noarch
opencv-devel: opencv-devel-3.4.6-8.el8.x86_64
  gavl-devel: gavl-devel-1.4.0-1.el8.x86_64

Build error:

filter/facebl0r/facebl0r.cpp:192:64: error: 'LINE_AA' is not a member of 'cv'
               cv::ellipse(image, face_box, CV_RGB(255,0,0), 2, cv::LINE_AA);
                                                                ^
filter/facebl0r/facebl0r.cpp: In member function 'void TrackedObj::update_hist()':
filter/facebl0r/facebl0r.cpp:235:29: error: 'nullptr' was not declared in this scope
   cv::calcHist(&hue_roi, 1, nullptr, mask_roi, hist, 1, &hist_bins, &range);
                             ^
filter/facebl0r/facebl0r.cpp: In member function 'cv::RotatedRect TrackedObj::camshift_track_face()':
filter/facebl0r/facebl0r.cpp:244:32: error: 'nullptr' was not declared in this scope
   cv::calcBackProject(&hue, 1, nullptr, hist, prob, &range);
                                ^
filter/facedetect/facedetect.cpp: In member function 'void FaceDetect::draw()':
filter/facedetect/facedetect.cpp:252:42: error: 'FILLED' is not a member of 'cv'
             int thickness = stroke <= 0? cv::FILLED : cvRound(stroke * 100);
                                          ^
filter/facedetect/facedetect.cpp:253:39: error: 'LINE_AA' is not a member of 'cv'
             int linetype = antialias? cv::LINE_AA : 8;

select0r hue term for cylindrical space not handled correctly(?)

Still verifying with original author, but it appears to me that the hue term in HCI cylindrical space distance calculations for the select0r plugin is not handled correctly.

The rgb2hci function appears to work correctly, returning a hue term in the range of (0.5,0.5] going from cyan (-0.5, exclusive) on the counter-clockwise side through blue (-1/3rd), magenta (-1/6th), red (0), yellow (1/6th), green (1/3rd), to cyan (0.5, inclusive).

In the cylindrical color space distance functions, however, the hue term, crossing across zero, is handled via these lines:

    ax=fabsf(hue-chue);
    if (ax>0.5) ax=ax-0.5;

Where hue and chue are the two colors' hue components, fabsf takes the absolute value, and ax is ostensibly the angular distance,

This causes an issue with e.g. comparing magenta (-0.1666) and cyan (0.5), nearly opposite colors on a hue wheel:

    ax = fabsf(0.5 - -0.1666) // -> 0.6666...
    if (ax > 0.5) { // true
      ax = ax - 0.5; // 0.6666 - 0.5 -> 0.16666
    }

Making the hue distance between them equivalent to, say, red and yellow, which are neighboring on a hue wheel.

If plotted, it becomes more readily apparent that instead of the distance function being smooth, it is discontinuous. imgur.com/XUpvf6f

There are many ways to handle this, two common ones employed will find favor depending on which ends up compiling to faster execution.
A branched approach:

ax = hue - chue;
if (ax > 0.5) { ax -= 1; }
else if (ax < -0.5) { ax += 1; }

A non-branched approach:

ax = 0.5 - fabsf(fabsf(hue - chue) - 0.5);

Either should result in an appropriate hue difference (angle difference) and a continuous function. imgur.com/6TNOJXW
( both assume the angles to be normalized in the -0.5 .. 0.5 range and should not be used as general purpose angle difference formula )

Note that proposed changes to this code will affect its results when using one of the cylindrical color spaces, and dependent projects may wish to add a compatibility flag or advise end-users of such a change.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.