Make a high-quality GIF in Cinelerra GG.

I try to adapt this FFMPEG code to cinelerra GG.

Using the terminal and converting a video to GIF is easy.

But I try to use Cinelerra GG as it has FFMPEG options.

the source of the original code is here.

Do you think it is possible?

#!/bin/shpalette=/tmp/palette.pngfilters=fps=15,scale=320:-1:flags=lanczosffmpeg -v warning -i $1 -vf $filters,palettegen -y $paletteffmpeg -v warning -i $1 -i $palette -lavfi $filters ; [1:v] paletteuse -y $2

Both palettegen and paletteuse are commented out in Cinelerra because of these errors:

[palettegen @ 0x4d10640] [Eval @ 0x7fffffff9e60] Undefined constant or missing ( in ###Resourcetemporarilyunavailable
[palettegen @ 0x4d10640] Unable to parse option value ###Resource temporarily unavailable
[palettegen @ 0x4d10640] [Eval @ 0x7fffffff9e90] Undefined constant or missing ( in ###Resourcetemporarilyunavailable
[palettegen @ 0x4d10640] Unable to parse option value ###Resource temporarily unavailable
[palettegen @ 0x4d10640] Error setting option max_colors to value ###Resource temporarily unavailable.
[palettegen_529 @ 0x4a4e4c0] Error applying options to the filter.
PluginFFilter::new_ffilter(palettegen)
err: Invalid argument

PluginFFilter::new_ffilter(paletteuse)
err: Input/output error

Providing initial correct arguments to palettegen, might make it usable. But I am not sure about paletteuse.

I did not see the pallette.png source in the url you quoted.

** Posted by: @phylsmith2004 **I did not see the pallette.png source in the url you quoted.
It was part of the script

is below Color mapping and dithering > USAGE.

I will look for more information in the ffmpeg manual. :grinning_face:

@sparkill

A little more discovery here. The problem with a few of the ffmpeg filters is the inability of Cinelerra to input a filename for the output. If the output file was a parameter, for example like stats_mode=single or in this case output_file=/tmp/palette.png then Cinelerra could handle it. That is the problem with both palettegen and paletteuse. I could get palettegen to work in single mode because it does not have to write to an unknown output file as you can see in the attached png file.

However, paletteuse requires not only an output.gif filename, but also the input palette.png file and there is no way to specify them as is done on the ffmpeg command line version.

Screenshot-from-2021-07-11-13-39-20.png

As an example, the ffmpeg filters metadata and ametadata have file parameters. As in:

metadata=mode=print:**file=**pipe:4

silencedetect,ametadata-mode-print:**file=**metadata.txt

@phylsmith2004

I tried other video editors same result.

this explains more.

You could easily finish the posted steps faster than you could click through Photoshop, once you’re familiar with the steps. Especially if they’re turned into a simple script file.

That aside, creating optimized GIF is a two-pass procedure. The first pass has to analyze what colors were most frequently used in the entire video, which can’t be known until the video is exported. Then it has to be reprocessed to convert colors to the optimized palette. Remember that Photoshop has access to something that Shotcut doesn’t — the finished video for analysis. So, it’s not really a Shotcut problem. It’s the procedural nature of GIF requiring two steps. Perhaps a second pass could be written into Shotcut, but that’s very custom code.

I totally sympathize with your goal of simpler export. GIF is just a bit unique.

I found more and GIF need two pass for better quality.

Using the script is easier. :confused: