wrong colors in animated GIF

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

wrong colors in animated GIF

Michael Koch
Hi,

I'm using this animated GIF as input http://gosper.org/sidereal.gif
and process it with the most simple FFmpeg command line:

ffmpeg -i sidereal.gif -y out.gif

Why are the colors wrong in the output?

I did already try to add   -vf format=pix_fmts=rgb24   but the output is
the same.

Michael



C:\Users\mKoch\Desktop>c:\ffmpeg\ffmpeg -i sidereal.gif -y out.gif
ffmpeg version N-94982-gea673a0edb Copyright (c) 2000-2019 the FFmpeg
developers

   built with gcc 9.2.1 (GCC) 20190918
   configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfi
g --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d
--enable-libb
luray --enable-libfreetype --enable-libmp3lame
--enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-libshine --e
nable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame
--enable
-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 -
-enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib
--enable-gmp --enab
le-libvidstab --enable-libvorbis --enable-libvo-amrwbenc
--enable-libmysofa --en
able-libspeex --enable-libxvid --enable-libaom --enable-libmfx
--enable-ffnvcode
c --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec
--enable-dxva2 -
-enable-avisynth --enable-libopenmpt --enable-amf
   libavutil      56. 35.100 / 56. 35.100
   libavcodec     58. 58.101 / 58. 58.101
   libavformat    58. 32.104 / 58. 32.104
   libavdevice    58.  9.100 / 58.  9.100
   libavfilter     7. 58.102 /  7. 58.102
   libswscale      5.  6.100 /  5.  6.100
   libswresample   3.  6.100 /  3.  6.100
   libpostproc    55.  6.100 / 55.  6.100
Input #0, gif, from 'sidereal.gif':
   Metadata:
     comment         : Created by Wolfram Mathematica 9.0 : www.wolfram.com
   Duration: 00:00:24.10, start: 0.000000, bitrate: 2782 kb/s
     Stream #0:0: Video: gif, bgra, 1000x1000, 10 fps, 10 tbr, 100 tbn,
100 tbc
Stream mapping:
   Stream #0:0 -> #0:0 (gif (native) -> gif (native))
Press [q] to stop, [?] for help
Output #0, gif, to 'out.gif':
   Metadata:
     comment         : Created by Wolfram Mathematica 9.0 : www.wolfram.com
     encoder         : Lavf58.32.104
     Stream #0:0: Video: gif, bgr8, 1000x1000, q=2-31, 200 kb/s, 10 fps,
100 tbn,
  10 tbc
     Metadata:
       encoder         : Lavc58.58.101 gif
frame=   19 fps=0.0 q=-0.0 size=     210kB time=00:00:01.81 bitrate=
950.2kbits/
frame=   38 fps= 36 q=-0.0 size=     256kB time=00:00:03.71 bitrate=
565.3kbits/
frame=   56 fps= 36 q=-0.0 size=     512kB time=00:00:05.51 bitrate=
761.2kbits/
frame=   74 fps= 36 q=-0.0 size=     768kB time=00:00:07.31 bitrate=
860.7kbits/
frame=   93 fps= 36 q=-0.0 size=    1024kB time=00:00:09.21 bitrate=
910.8kbits/
frame=  112 fps= 36 q=-0.0 size=    1024kB time=00:00:11.11 bitrate=
755.1kbits/
frame=  131 fps= 36 q=-0.0 size=    1280kB time=00:00:13.01 bitrate=
806.0kbits/
frame=  150 fps= 36 q=-0.0 size=    1536kB time=00:00:14.91 bitrate=
843.9kbits/
frame=  169 fps= 36 q=-0.0 size=    1792kB time=00:00:16.81 bitrate=
873.3kbits/
frame=  187 fps= 36 q=-0.0 size=    2048kB time=00:00:18.61 bitrate=
901.5kbits/
frame=  206 fps= 36 q=-0.0 size=    2304kB time=00:00:20.51 bitrate=
920.3kbits/
frame=  225 fps= 36 q=-0.0 size=    2304kB time=00:00:22.41 bitrate=
842.2kbits/
frame=  241 fps= 36 q=-0.0 Lsize=    2688kB time=00:00:24.01 bitrate=
917.0kbits
/s speed=3.57x
video:2688kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing
overhead: 0.000727%
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: wrong colors in animated GIF

Carl Eugen Hoyos-2
Am Do., 26. Sept. 2019 um 15:00 Uhr schrieb Michael Koch
<[hidden email]>:

> I'm using this animated GIF as input http://gosper.org/sidereal.gif
> and process it with the most simple FFmpeg command line:
>
> ffmpeg -i sidereal.gif -y out.gif

Did you also try the following "most simple FFmpeg commamd line"?
ffmpeg -i sidereal.gif -qscale 2 out.avi

> Why are the colors wrong in the output?

I suspect you didn't read about gif encoding with FFmpeg.
(This is a known regression but unlikely to get fixed, output
files were absurdly big.)

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: wrong colors in animated GIF

Michael Koch
Am 26.09.2019 um 15:06 schrieb Carl Eugen Hoyos:
> Am Do., 26. Sept. 2019 um 15:00 Uhr schrieb Michael Koch
> <[hidden email]>:
>
>> I'm using this animated GIF as input http://gosper.org/sidereal.gif
>> and process it with the most simple FFmpeg command line:
>>
>> ffmpeg -i sidereal.gif -y out.gif
> Did you also try the following "most simple FFmpeg commamd line"?
> ffmpeg -i sidereal.gif -qscale 2 out.avi

ok, that works fine.

>
>> Why are the colors wrong in the output?
> I suspect you didn't read about gif encoding with FFmpeg.
> (This is a known regression but unlikely to get fixed, output
> files were absurdly big.)

No, I didn't read about gif encoding. I did use other examples with gif
output before and there were no problems.

Thanks,
Michael

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: wrong colors in animated GIF

Javier Infante Porro
In reply to this post by Michael Koch
Hi Michael,

----- Mensaje original -----

> De: "Michael Koch" <[hidden email]>
> Para: "FFmpeg user questions" <[hidden email]>
> Enviados: Jueves, 26 de Septiembre 2019 14:50:50
> Asunto: [FFmpeg-user] wrong colors in animated GIF
>
> Hi,
>
> I'm using this animated GIF as input http://gosper.org/sidereal.gif
> and process it with the most simple FFmpeg command line:
>
> ffmpeg -i sidereal.gif -y out.gif
>
> Why are the colors wrong in the output?

I suspect it is something about the palette generated.
I have been using palettegen and paletteuse filters lately, and they have worked out fine for me.



This command is working as you might expect:

ffmpeg -y -i sidereal.gif -filter_complex "split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse"  sidereal2.gif
(2.8M)

In fact, limiting the number of colors to 128, makes the file smaller:
ffmpeg -i sidereal.gif -filter_complex "split[s0][s1];[s0]palettegen=max_colors=24[p];[s1][p]paletteuse"  sidereal2.1.gif
(2.2M)


Hope it helps!

Cheers
               
               
--
Javier Infante Porro
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: wrong colors in animated GIF

Carl Eugen Hoyos-2
In reply to this post by Michael Koch
Am Do., 26. Sept. 2019 um 15:25 Uhr schrieb Michael Koch
<[hidden email]>:

>
> Am 26.09.2019 um 15:06 schrieb Carl Eugen Hoyos:
> > Am Do., 26. Sept. 2019 um 15:00 Uhr schrieb Michael Koch
> > <[hidden email]>:
> >
> >> I'm using this animated GIF as input http://gosper.org/sidereal.gif
> >> and process it with the most simple FFmpeg command line:
> >>
> >> ffmpeg -i sidereal.gif -y out.gif
> > Did you also try the following "most simple FFmpeg commamd line"?
> > ffmpeg -i sidereal.gif -qscale 2 out.avi
>
> ok, that works fine.

I just wanted to point out that you tested with a highly unusual
command line that produced a several-hundred-MB file when
it worked in the past.

> >> Why are the colors wrong in the output?
> > I suspect you didn't read about gif encoding with FFmpeg.
> > (This is a known regression but unlikely to get fixed, output
> > files were absurdly big.)
>
> No, I didn't read about gif encoding. I did use other examples with gif
> output before and there were no problems.

There definitely were problems, you probably missed them.
(The colours were off unless you used so few that you couldn't see
the difference.)

Javier has posted a command line, this is the original blog post:
http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
Googling for "ffmpeg gif" shows many pages.

Note that your sample file gets significantly smaller without
any quality loss.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: wrong colors in animated GIF

Michael Koch
In reply to this post by Javier Infante Porro
Hi Javier,

>
> I suspect it is something about the palette generated.
> I have been using palettegen and paletteuse filters lately, and they have worked out fine for me.
>
>
>
> This command is working as you might expect:
>
> ffmpeg -y -i sidereal.gif -filter_complex "split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse"  sidereal2.gif
> (2.8M)
>
> In fact, limiting the number of colors to 128, makes the file smaller:
> ffmpeg -i sidereal.gif -filter_complex "split[s0][s1];[s0]palettegen=max_colors=24[p];[s1][p]paletteuse"  sidereal2.1.gif
> (2.2M)

thank you very much for this example. It works as expected. I have
already added it to my book:
http://www.astro-electronic.de/FFmpeg_Book.pdf

Michael

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".