Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] Generate GIF animations #3

Closed
sk33z3r opened this issue Mar 15, 2022 · 3 comments · Fixed by #30
Closed

[python] Generate GIF animations #3

sk33z3r opened this issue Mar 15, 2022 · 3 comments · Fixed by #30
Assignees
Labels
enhancement New feature or request

Comments

@sk33z3r
Copy link
Collaborator

sk33z3r commented Mar 15, 2022

Need a way to differentiate between a GIF and a STATIC collection.

Most likely need imagemagick's convert, and will have to be very specific on how to organize the folder structure.

@sk33z3r sk33z3r added the enhancement New feature or request label Mar 15, 2022
@sk33z3r sk33z3r assigned sk33z3r and unassigned sk33z3r Mar 15, 2022
@Montspy
Copy link
Owner

Montspy commented Mar 18, 2022

I tried layering GIFs with ffmpeg and was successful:

ffmpeg -y -i dancer.gif -ignore_loop 0 -i sunset.gif -filter_complex "[0][1]overlay=format=auto:shortest=1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" output.gif

Overlay filter docs: https://ffmpeg.org/ffmpeg-filters.html#overlay-1
output

@Montspy Montspy self-assigned this Mar 22, 2022
@Montspy
Copy link
Owner

Montspy commented Mar 23, 2022

For metadata generation of MP4s, we should generate a GIF out of it for image until explorer can handle non-images in image, or until we get marketplace

@Montspy
Copy link
Owner

Montspy commented Mar 23, 2022

Turns out MP4 (aka h.264) does not support alpha channels.
The recommended video format with alpha for web is WebM with VP9 codec. https://pixelbakery.co/recipes/list-of-video-image-formats-in-2021-supporting-alpha-channels
ffmpeg supports WebM with VP9. Example command for conversion with alpha channel:

ffmpeg -y -i sunset.gif  -c:v libvpx-vp9 -b:v 0 -crf 30 -row-mt 1 -pix_fmt yuva420p sunset.webm

-c:v libvpx-vp9 forces the libvpx VP9 codec
-b:v 0 -crf 30 forces variable bitrate with constant quality (good for final export) of 30 (0-63, lower is higher quality)
For intermediate steps, I'm thinking of using -lossless instead. Both for speed and to limit the quality loss with high layer counts
-row-mt 1 is using row multithreading. To be confirmed if this speeds conversions up or not
-pix_fmt yuva420p uses YUVA (YUV+Alpha) 4:2:0 pixel format. 4:2:0 is the most used on the web

@sk33z3r sk33z3r changed the title Generate GIF animations [python] Generate GIF animations Apr 4, 2022
@Montspy Montspy linked a pull request Apr 4, 2022 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants