A guide about computing the temporal average/median of video frames with G'MIC

It is definitely a little tricky to link it correctly and has been discussed in the past, the latest being GMIC compile error with opencv version 4.

I’m not having any compile errors, neither is brew’s compiler, it just doesn’t work afterwards.

No, I tried it with my home build iatest version and had the same effect!!

Do you mean yours does not work either?

Yes, I tried around with zsh and bash, that’s the reason I am convinced it is a string parameter problem.
I tried with additional parameter and they were taken as file name, including the commas!!

You can’t pass post file extension arguments via bash if you are using an absolute path to the output file. This doesn’t work with your old compiled version either. If you run it to outpu at the same directory ‘-o file.tif,ushort’ that works. Besides, even if you run png with no comma arguments it still doesn’t run on the brew / source compiled version

Some more info:

The prebuild from Release Continuous build · aferrero2707/gmic-osx · GitHub is bullt without opencv! Hence it stops without any message.

My MacPort build (gmic) is working, still video files with quoted characters are only accepted with double quotes:

$ gmic average_video Library/Containers/com.apple.mail/Data/Library/Mail\ Downloads/D9AFA38/VID-20181005-WA0002.mp4,20,test.avi
[gmic]-0./ Start G’MIC interpreter.
[gmic]-0./ Average frames of input video file ‘Library/Containers/com.apple.mail/Data/Library/Mail Downloads/D9AFA38/VID-20181005-WA0002.mp4,20,test.avi’, with first frame 0, last frame -1, frame step 1 and output filename ‘’.
OpenCV: Couldn’t read video stream from file “Library/Containers/com.apple.mail/Data/Library/Mail Downloads/D9AFA38/VID-20181005-WA0002.mp4,20,test.avi”

[gmic]-0./ End G’MIC interpreter.
$ gmic average_video Library/Containers/com.apple.mail/Data/Library/Mail\ Downloads/D9AFA38/VID-20181005-WA0002.mp4,20,test.avi
[gmic]-0./ Start G’MIC interpreter.
[gmic]-0./ Average frames of input video file ‘Library/Containers/com.apple.mail/Data/Library/Mail Downloads/D9AFA38/VID-20181005-WA0002.mp4’, with first frame 0, last frame -1, frame step 20 and output filename ‘test.avi’.

Frame #0 OpenCV: FFMPEG: tag 0x5634504d/‘MP4V’ is not supported with codec id 12 and format ‘avi / AVI (Audio Video Interleaved)’
OpenCV: FFMPEG: fallback to use tag 0x34504d46/‘FMP4’
Frame #960
[gmic]-1./ End G’MIC interpreter.

In the first case (one backslash) the commas and parameters are taken as part of the string!
I think it has something todo with the handling of strings in gmic AND in opencv.

In the second case (double backslash) gmic discriminates file name and parameter as expected!?

I don’t see where the backslash is but I don’t see how this is relevant to my question.

I feel like you are not reading my question or we are passing in the dark. That is not the prebuilt I am using, I’m using your binaries Index of /gmic/git which works with the parameters that I am passing no problem. It’s only when I try to install the one on brew, or download and compile on my computer(no errors) does it have the issue that I noted.

Also, I’m not passing parameters in comma concatenated form, I use the explicit arguments like -o.

These builds are fairly old. It is not recommended to use them anymore! I have stopped the building since some time. I am using MacPorts gmic and build for my privat use the latest git version ((cd ~/work/src/gmic/src/; make -B cli “SUBLIBS=-lX11” || exit; sudo cp ~/work/src/gmic/src/gmic /usr/local/bin/) ), still with the libraries from MacPorts, besides the prebuild from Andrea.

Well, I did build the latest stable release from git using the makelist there but that didn’t work either. Getting the macports to build it now. Macports is installing a ridiculuous number of dependencies, surely gmic doesn’t need three different versions of python.

I just compiled it on another computer, the same error persists. Could you upload the binary and libs you made from the latest stable git?

It is possible that the opencv4 library is not being found as opencv

I did not build any libraries, I have only the executable.

Yeah that number of ports loaded by mac parts is incredible…

I’ll put the exe as gmic.zip in the remote folder you used for download. But I#ll will delete these old things soon!

I#m using opencv not opencv4

You have opencv from 2009 installed still? We had opencv2, 3 and now 4 since. In 4, Opencv dropped pkgconfig support

I am guessing that it is cv2 since that is the lowest version in most repositories. I wonder if OpenCV integration is just for video. If that is the case, is there a lighter weight and license compatible package that could replace it?

I tried installing opencv@2 from homebrew but that didn’t do it either.

I think you try to corrupt your system!

I have opencv 3.7 . I don’t know how you (and @afre) have such ideas.

Do

otool -L gmic

Because Opencv4 does not include pkgconfig, and installs as opencv4 even if you do install with the optional flag. The way that gmic is looking for the package is outdated and so cannot find opencv if you have recent versions installed so you have to willingly install an older version for it to compile without changing the makefiles on gmic.

I compiled and installed opencv 3.4.8 which still goes by opencv in package land, let’s see how this goes…

still doesnt like something
[ 66%] Generating resources/gmic_bashcompletion.sh
make[2]: *** [resources/gmic_bashcompletion.sh] Error 127
make[2]: *** Deleting file resources/gmic_bashcompletion.sh' make[1]: *** [CMakeFiles/bashcompletion.dir/all] Error 2 make: *** [all] Error 2 iMac:gmic-2.7.4 4 jajanene$ make uninstall make: *** No rule to make target uninstall’. Stop.
iMac:gmic-2.7.4 4 jajanene$

Derin, using make with Makefile for gmic there is no config etc. necessary. That might be old-fashioned. I must confess my collection of packages in MacPort is tremendously grown, one large disadvantage, still gmic is IMHO not prepared for opencv4, and in fact opencv was often if not always a problem. Hence my gmic build can only work with opencv (3 actually)