Notifications
Clear all

Make a high-quality GIF in Cinelerra GG.

   RSS

0
Topic starter

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.

http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html

Do you think it is possible?

#!/bin/sh

palette="/tmp/palette.png"

filters="fps=15,scale=320:-1:flags=lanczos"

ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
5 Answers
0

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.

0
Topic starter
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. 😀 

 

0

@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.

0

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

0
Topic starter

@phylsmith2004

 

I tried other video editors same result.

this explains more.

https://forum.shotcut.org/t/increasing-exported-gif-quality-doesnt-remove-artifacting-or-increase-quality-or-increase-file-size/21738/3

 

https://forum.shotcut.org/t/export-as-gif-poor-quality-with-the-default-gif-preset/27690

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. :/

 

 

This post was modified 2 weeks ago 2 times by sparkill
Share: