How can I Use a palette to encode a GIF using ffmpeg?
See original GitHub issueLike this : ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
import ffmpeg
in_filename='C:\Users\Administrator\Desktop\py\img\'
(
ffmpeg
.input(in_filename+'girl.gif')
# .filter('palettegen', stats_mode='full')
# .output(in_filename+'palettegen_full.png')
.filter(filter_name='paletteuse', dither='bayer')
.output(in_filename+'paletteuse_bayer.gif')# , vframes=1, format='image2', vcodec='mjpeg'
.run(input=b'y')
)
##Error:
Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_paletteuse_0
Traceback (most recent call last):
File ".../test_little.py", line 116, in
.run(input=b'y')
File "...\venv\lib\site-packages\ffmpeg_run.py", line 305, in run
raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to make GIFs with FFMPEG - GIPHY Engineering
palettegen is a filter that generates a 256 color palette to be used in GIF encoding in the next step. Like the filter...
Read more >How do I convert a video to GIF using ffmpeg, with reasonable ...
ffmpeg commands: Run this command so that ffmpeg can figure out a good palette:
Read more >How to Make a GIF from a Video Using FFmpeg - Bannerbear
By default, FFmpeg uses a generic 256-color palette for every GIF encoding and doesn't take into account the colors in the input video....
Read more >ffmpeg save or encode GIFs (with palette generation) from ...
import os. import numpy as np. def save_gif(gif_fname, images, fps=4):. """ To generate a gif from image files, first generate palette from images....
Read more >How to Convert Videos to GIFs Using FFmpeg - Baeldung
In this article, we learned how to use the FFmpeg command-line tool to convert a video to a high-quality gif by generating a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Instead of using ffmpeg.concat, use the multi-input form of ffmpeg.filter. e.g.:
Aha,I got it.Although the output image is not the clarity I want, perhaps it is not appropriate for me to generate a palette. Thank you.