Problems with G'MIC cauldron tutorial

I am referring to this page of the tutorial

I am on Debian/sid, using latest G’MIC version from github.

Here are the results and the conclusion I have reached.
This command failed for me in the past too, which held me back then from looking into g’mic any further. Perhaps you have lost more people interested into this in the past.

Here is a detailed list of what I found.
The file is an emacs org file with the org extension replaced with txt to make the upload possible.

gmic.txt (4.1 KB)

Yes, this is clearly related to a video output issue. I’ve tested the same script here on my Ubuntu 16.04, and it works as expected: it produces a .mov file that I can read with mplayer.
To read/write video files, G’MIC relies on OpenCV’s routines, and it seems that in your case the codec ‘MP4V’ is undefined, and unfortunately, this is the default video codec used in G’MIC.
Maybe you can try changing the codec, like this:

$ gmic 360,240,90,3 -noise[-1] 0.2,2 -bandpass 0.005,0.02 -normalize 0,255 -split z -o toto.mpg,20,MPEG 

then:

$ file toto.mpg
toto.mpg: MPEG sequence, v1, system multiplex

Ah. Yes indeed.
The command you suggested does work for me. Thanks :slight_smile:

Perhaps you should change the command on the tutorial page to the one above, to not scare off unknowing passers by?
Up to you.

Thanks

BTW running your gmic command, but with the 100x1x1x1 image as the first in the pipeline still causes a crash

me:medion:tmp/ |detached: ✓|$ gmic 100 360,240,90,3 -noise[-1] 0.2,2 -bandpass 0.005,0.02 -normalize 0,255 -split z -o toto.mpg,20,MPEG
[gmic]-0./ Start G’MIC interpreter.
[gmic]-0./ Input black image at position 0 (1 image 100x1x1x1).
[gmic]-1./ Input black image at position 1 (1 image 360x240x90x3).
[gmic]-2./ Add salt&pepper noise to image [1], with standard deviation 0.2.
[gmic]-2./ Apply bandpass filter [0.005,0.02] to images [0,1].
[gmic]-2./ Normalize images [0,1] in range [0,255].
[gmic]-2./ Split images [0,1] along the ‘z’-axis.
[gmic]-91./ Output images [0,1,2,(…),88,89,90] as mpg file ‘toto.mpg’, with 20 fps and MPEG codec.
[gmic]-91./ *** Warning *** Command ‘-output’: Cannot encode file ‘toto.mpg’ natively ([instance(91,128,0x561963c048c8)] CImgList::save_video(): File ‘toto.mpg’, unable to initialize video writer with codec ‘MPEG’.). Trying fallback function.
[gmic]-91./ *** Error *** Command ‘-o’: [instance(91,128,0x561963c048c8)] CImgList::save_ffmpeg_external(): Invalid instance dimensions for file ‘toto.mpg’.
[gmic] Command ‘-o’ has the following description:

-o: Equivalent to '-output'.

-output (+):
                    [type:]filename,_format_options

    Output selected images as one or several numbered file(s).
    (eq. to '-o').

    
    Default value: 'format_options'=(undefined).

Ah yes, I wonder why there is the first 100 in the command line, I have to fix this :slight_smile:

Could it be that the video output takes the dimensions of the first image in the pipeline, but borks on 100x1?
Because if I place the 100 at the end of the pipeline, it works OK.

In fact, the 100 is indeed obsolete to demonstrate the cauldron effect.

Yes, the 100 is a bug, I don’t know why it has been put here :slight_smile:

While you are at it, I recommend replacing the 900 slices by a more modest number.
In my case (a meagre 4 GB RAM), my system locks up with the 900 slices, trashing like mad. :slight_smile:

Tutorial is not out.

@grosgood Please come to the rescue!

The link at the top of this post points into the Ancien Régimes tutorials (pre-2.0), not readily available because there is quite a bit of deprecated G’MIC notation in them. But the cauldron tutorial was re-written and updated, and now lives here: Cauldron, Anyone? As presently written, generating the 200 image sequence, 360×240, takes about 0.75 gig of memory:

cauldron:
   -input 360,240,200,3
   -noise[-1] 0.2,2
   -bandpass 2%,3%
   -normalize 0,255
   -display
   -split z
   -output cauldron.mp4,24,h264

 $ gmic cauldron.gmic -verbose + -cauldron -verbose -
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Input custom command file 'cauldron.gmic' (1 new, total: 4552).
[gmic]-0./ Increment verbosity level (set to 2).
[gmic]-0./cauldron/ Input black image at position 0 (1 image 360x240x200x3).
[gmic]-1./cauldron/ Add salt&pepper noise to image [0], with standard deviation 0.2.
[gmic]-1./cauldron/ Apply bandpass filter [2%,3%] to image [0].
[gmic]-1./cauldron/ Normalize image [0] in range [0,255], with constant-case ratio 0.
[gmic]-1./cauldron/ Display image [0] = '[unnamed]', from point (180,120,100).
[0] = '[unnamed]':
  size = (360,240,200,3) [197 Mio of float32].
  data = (128.162,131.093,133.638,135.768,137.465,138.717,139.523,139.89,139.832,139.374,138.546,137.386,(...),127.24,126.957,126.86,126.962,127.271,127.793,128.532,129.489,130.661,132.043,133.626,135.401).
  min = 0, max = 255, mean = 129.187, std = 28.3084, coords_min = (344,103,28,0), coords_max = (38,157,34,0).
[gmic]-1./cauldron/ Split image [0] along the 'z'-axis.
[gmic]-200./cauldron/ Output images [0,1,2,(...),197,198,199] as mp4 file 'cauldron.mp4', with 24 fps and h264 codec.
[gmic]-200./ Decrement verbosity level (set to 1).
[gmic]-200./ End G'MIC interpreter.

To warp an overlay, start with some image file, here cauldron_title.png:
cauldron_title

Take the animation generated from cauldron (cauldron.mp4) and warp the overlay using the red and green channels and the -warp command:

cauldron_over:
   -input cauldron.mp4
   -blur 1
   -input cauldron_title.png
   -repeat $!-1
      -local[$>,-1]
         +channels[0] 0,1
         -normalize. -15,15
         +warp[1] [-1],1
         -remove..
         -shared. 100%
         -normalize. 0,255
         -remove.
         -blend[0,-1] alpha
      -done
   -done
   -remove.
   -output cauldron2.mp4,24,h264

There is a typo (dammit!) in the revised tutorial — a space character separating the local command from its selection decorator, which gives rise to a messy reintroduction of the entire image list into the local context, rather than one animation frame and one copy of the overlay text. Needless to say, Things Don’t Work. Fixed above, and soon to be fixed in the tutorial.

Final animation:

1 Like